Is it possible to force the identify command to only read the header of an image file (if possible) instead of reading the whole file before output.
I'm interested in getting back the width/height quickly without loading image data.
Mikael
identify - force header only
Re: identify - force header only
Identify does not load all the image data unless you specify -verbose. What is the type of image you are trying to get the information from? Maybe the coder for that format has to read all the data before it can give you the width/height.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify - force header only
Code: Select all
identify -format "%wx%h" yourimage
Re: identify - force header only
You're right as a test I did: format %[fx:w]x[fx:h] from the inch example and it forces a complete image load 
Using format %wx%h works as expected, perfect.
Mikael

Using format %wx%h works as expected, perfect.
Mikael
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify - force header only
If you need calculations from image dimensions, "convert" with "-ping" and "fx:" doesn't read the pixels:
Code: Select all
convert -ping g.png -format "%[fx:w/3]\n%[fx:h/3]" info:
snibgo's IM pages: im.snibgo.com