[IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
paulborile

[IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post by paulborile »

We are using IM 6.5.4-6 for windows 32bit to gather jpeg image information and we are experiencing
very long time for "identify.exe -verbose <filename>.jpg" such as :
- on a Intel Core 2 DUO T6570 2.1 Ghz Windows 7, 4GB PC : 17 seconds to process a 5 MB jpg file
(here if you want to test it http://www.icona.it/downloads/page_0001.jpg). The file is on a local
disk and nothing else is using up cpu on the PC we used for the test.

Is there any way to speed up identify -verbose (we need the -verbose option) ?
We cannot use -format because we need some piece of information which is not managed by -format
options.

We also found out that if we execute the identify command above more than one time we get different
execution times : 17 secs, then 28 secs, then again 17 secs and then again 28 secs. If we execute 2 identify
concurrently we always get 17 secs.

Any ideas ?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: [IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post by magick »

We suspect the identify command is computing much more than you need such as the image histogram and image statistics. On our 3.0 Ghz processor, the identify command ran in just over 5 seconds. The solution may be to call only the ImageMagick methods you need. For example, you can use PerlMagick to return just one or two image attributes. What attribute are you looking for?
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: [IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post by Drarakel »

For large JPGs, you can usually add a '-define jpeg:size' parameter (unless you need the full statistic/histogram).
So, such a command will be very quick on your file:
identify -verbose -define jpeg:size=64x64 page_0001.jpg
But as you're using an older IM version, the following command could still be working for you:
identify -verbose -size 64x64 page_0001.jpg
See also here:
http://www.imagemagick.org/Usage/formats/#jpg_read
paulborile

Re: [IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post by paulborile »

Thanks Drarakel, the -size option does not affect the info we use (we just have to read base geometry
instead of geometry) and dramatically cuts execution time from 17 secs to ~2.

We are working now to speed up identify on TIFF and JP2 files : we are at 12 secs for a
a 4MB tiff file (http://www.icona.it/downloads/0001.tif) and 7 seconds for a 850K Jp2
(http://www.icona.it/downloads/0001.jp2).

We need a lot of info some of which is not available with the -format options so we process
the identify -verbose output. Here's the set of data we parse :

Info we could parse using identify -format :

page geometry
current image height in pixels
magick
current width in pixels
x resolution
y resolution
image depth
image compression type
page height
page width

directly from identify -verbose output :

/Image/Channel depth/gray
/Image/Type
Bit per Sample
Image/Properties/create-date

I'll check to see if with the latest version we get better performance on these 2 file types.

Ciao
-Paul
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: [IM 6.5.4-6] identify.exe slow on a 5MB jpg file

Post by Drarakel »

The only other IM command that I know of that makes the process quicker is "identify -verbose -ping <file>". But this will render the type/depth info useless.
For the 'create-date', I think I would just use "dir". And did you try "%[colorspace]" (or maybe "%r") with "identify -format"? It's not the same as Type, but at least it does report "Gray" for your last two files.
(Anyway, I don't think that there's a bug in identify. :wink:)
Post Reply