QuantizeImage() method takes too much CPU

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
livable

QuantizeImage() method takes too much CPU

Post by livable »

Hi all, I tried to use QuantizeImage to reduce the gif-image's color, and found that as I increase the load (using LoadRunner),the CPU keeps raising until it gets 94%,here is my code below,

Code: Select all

         QuantizeInfo *q_info = AcquireQuantizeInfo( image_info );
          unsigned long colors = q_info->number_colors;
          q_info->dither = MagickFalse;
          //colors
          colors = colors / 2;
          if (colors < 3)
          {
                colors = 2;
           }
          q_info->number_colors = colors;
          QuantizeImage(q_info, thumbnails);
          //for debug
          //printf("Adapted colors to %lu\n",colors);
          DestroyQuantizeInfo(q_info);
PS:My system environment is 4 core Intel(R) Xeon(R) CPU E5320 @ 1.86GHz
MemTotal: 4050700 kB
My IM version is 6.4.0 and my OS is Linux ubuntu 2.6.24-23-server
Any advice is welcomed,thanks!
Post Reply