identify -format %[resolution.x] doesn't match %x

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wfzimmerman
Posts: 8
Joined: 2013-04-17T11:31:14-07:00
Authentication code: 6789

identify -format %[resolution.x] doesn't match %x

Post by wfzimmerman »

identify -format "%x" SeedImage_9.jpg produces 72 PixelsPerInch
identify -format "[resolution.x]" SeedImage_9.jpg produces empty line.


What gives? I just want the dpi without having to parse out the unit text.

Fred

Image
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: identify -format %[resolution.x] doesn't match %x

Post by GreenKoopa »

wfzimmerman wrote:identify -format "[resolution.x]" SeedImage_9.jpg
You were close. The fx expression should be:

identify -format "%[fx:resolution.x]" SeedImage_9.jpg
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: identify -format %[resolution.x] doesn't match %x

Post by GreenKoopa »

On second look, you were even closer. Did you forget the % (%% in Windows batch)? This is what I get on IM 6.8.5-6:

Code: Select all

> identify -format "[resolution.x]" SeedImage_9.jpg
[resolution.x]
> identify -format "%x - %[resolution.x] - %[fx:resolution.x]" SeedImage_9.jpg
72 PixelsPerInch - 72 - 72
wfzimmerman
Posts: 8
Joined: 2013-04-17T11:31:14-07:00
Authentication code: 6789

Re: identify -format %[resolution.x] doesn't match %x

Post by wfzimmerman »

Puzzler! In ImageMagick 6.5.8-9 I get

identify -format "%x - %[resolution.x] - %[fx:resolution.x]" SeedImage_9.jpg
72 PixelsPerInch - - 72

i.e. it doesn't report the middle one.

I can just use the fx option. But is this a bug?
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: identify -format %[resolution.x] doesn't match %x

Post by GreenKoopa »

A bug, but apparently fixed. Your version of IM is extremely old!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify -format %[resolution.x] doesn't match %x

Post by fmw42 »

Puzzler! In ImageMagick 6.5.8-9 I get

identify -format "%x - %[resolution.x] - %[fx:resolution.x]" SeedImage_9.jpg
Some string formats, such as perhaps %[resolution.x], were not available until after your release. They have grown in the number of string formats over time as new ones have been requested. You can try to use the changelog to see when things were added. See http://www.imagemagick.org/script/changelog.php
Post Reply