identify -verbose is REALLY slow (enhancement request)

Post here to shower the ImageMagick developers with praise or discuss how you could have done a better job if you developed ImageMagick. Or talk about how Photoshop is better than ImageMagick. Even complain about how no one answered your postings in the Users forum. Venting and musings welcomed here.
Post Reply
rfg
Posts: 2
Joined: 2015-04-09T15:02:36-07:00
Authentication code: 6789

identify -verbose is REALLY slow (enhancement request)

Post by rfg »

I'm trying to reduce the on-disk size of a just the "fat" subset of a largish set of JPEGs. Many of these individual .jpg files are easy to deal with because they have resolutions (WxH) that are much bigger than what I need, so I've already scripted some stuff that uses the convert command to scrunch those down to smaller resolutions... a step which typically produces smaller on-disk file sizes.

Unfortunately, at least some of the input files already have modest (i.e. less than 1920x1080) resolution however they were created using rather absurd quality settings (e.g. 99). I can use (and am using) the simple form of the identify command to find the files that have excessively large resultions, but I also need to find the ones that have excessive quality values.

Unfortunately, the reqular (unadorned) identify command doesn't give me that, so I have to resort to using identify -verbose instead, and as I've just found out, that can take a lot of time...in excess on one full second for some input JPEG files. If you have thousands of input files... well... I hope you see the problem.

So please consider this as an enhancement request for the identify command. I dearly wish that either (a) it would display the JPEG quality value even when the -verbose option is not used... i.e. the "fast" case... or else (b) that there would be implemented some sort of minimalist version of the -verbose option that would still allow identify to run fast, but which would provide the input file resolution and its JPEG quality setting. (All those other great gobs of information that are produced by identify -verbose are interesting, I'm sure, but entirely non-useful for my purposes.)

Thanks for listening.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: identify -verbose is REALLY slow (enhancement request)

Post by magick »

Have you tried: identify -define jpeg:size=256x256 -format "%Q" image.jpg?
rfg
Posts: 2
Joined: 2015-04-09T15:02:36-07:00
Authentication code: 6789

Re: identify -verbose is REALLY slow (enhancement request)

Post by rfg »

>Have you tried: identify -define jpeg:size=256x256 -format "%Q" image.jpg?

No, cuz I have no idea what any of that means. May I ask you to explain?

P.S. Actually, I'm trying now (as we speak) to see if I can get at the attributes I need (e.g. JPEG quality + image dimensions) faster by using the Perl bindings that are available for ImageMagick... which I have just installed. I'm not sure yet how well this is going to work out in practice. Obviously, it depends a lot on the actual implementatation of things like $image->Read('foo.jpg') and $image->Get('quality'). If those do not cause the library to read the whole bloody image file in from disk, then maybe this will work for me.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify -verbose is REALLY slow (enhancement request)

Post by fmw42 »

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: identify -verbose is REALLY slow (enhancement request)

Post by glennrp »

Even faster is

Code: Select all

 identify -ping -format "%Q" image.jpg
Post Reply