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.
identify -verbose is REALLY slow (enhancement request)
Re: identify -verbose is REALLY slow (enhancement request)
Have you tried: identify -define jpeg:size=256x256 -format "%Q" image.jpg?
Re: identify -verbose is REALLY slow (enhancement request)
>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.
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.
Re: identify -verbose is REALLY slow (enhancement request)
Even faster is
Code: Select all
identify -ping -format "%Q" image.jpg