Page 1 of 1

QuantizeImage() method takes too much CPU

Posted: 2010-04-22T00:54:56-07:00
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!