(Solved )Histogram operator Randomly locks CPU

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
markmarques
Posts: 88
Joined: 2010-06-29T14:36:09-07:00
Authentication code: 8675308

(Solved )Histogram operator Randomly locks CPU

Post 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 ...
Last edited by markmarques on 2010-09-15T09:09:13-07:00, edited 2 times in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Histogram operator Randomly locks CPU

Post 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).
markmarques
Posts: 88
Joined: 2010-06-29T14:36:09-07:00
Authentication code: 8675308

Histogram operator generates BIG file

Post 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 ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: (Solved )Histogram operator Randomly locks CPU

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply