Page 1 of 1

(Solved )Histogram operator Randomly locks CPU

Posted: 2010-09-15T07:21:13-07:00
by markmarques
Hi ...
Only recently I get a strange behaviour with calling the "histogram:" operator ....

convert sdim004.jpg histogram:histogram.gif

Gives me full CPU ocuppation (I have a dual core) so I get a single core occupied

The image is 2688x1792 8 bit JPG
The strange fact is that It works in the first two or 3 calls ... after that it completly locks the cpu .... :(
When it works correctly I get a 256x200 bits GIF ... But with a strange "larger" (7Mb or biiger) size .... ?!?
What am doing wrong ?
If I try to convert it into a new file using "irfanview" or other program get a 15kb gif image ...(?)
Any ideas ?

Edited:
Due to some further reading (usage web docs) I have found that the CPU lock and or the size is all related to the "comment" part of the histogram ...
so It is now small and fast ... :)
Thanks for the help ...



Edited:
Forgot to mention that sometimes it works correctly ....
and I am using the pre-compiled windows Q16 6.6.3-7 version ...

Re: Histogram operator Randomly locks CPU

Posted: 2010-09-15T07:32:16-07:00
by magick
What do you mean "locks the CPU?" Is it at full utilization-- if so thats fine. Otherwise, you may have a buggy OpenMP or Posix threads implementation. Rebuild ImageMagick but add --disable-openmp to your configure script command line. We tried your command tens of times under Fedora 13 and it completed without complaint (with OpenMP enabled).

Histogram operator generates BIG file

Posted: 2010-09-15T08:48:14-07:00
by markmarques
After some more tests I realized that the CPU time to perform the histogram operation are higher than I antecipated ...
But now I wonder ...
Why does the resulting GIF file have such a big size ?
in a 2688x1768 image I get an 9Mb or 10Mb GIF file ...
If I read the GIF file and resave it I get a 5Kb final file ?
Any ideas ?

Re: (Solved )Histogram operator Randomly locks CPU

Posted: 2010-09-15T18:28:41-07:00
by anthony
histogram adds a very VERY large comment about the colors in the image.
See IM examples, histogram
http://www.imagemagick.org/Usage/files/#histogram

You can either junk the comment. Or better still (and faster) ask Im not to generate it.

From the above IM Examples section...
ImageThis comment can take a very long time to create. As of IM v6.6.1-5, you can add the special setting "-define histogram:unique-colors=false" which will turn off this comment generation if you do not need it.