Page 1 of 1

ImageMagick convert jpg images to gif being slow?

Posted: 2017-05-09T22:25:03-07:00
by royxr
I am using Magick++(IM 7.0.3, platform:CentOS Linux release 7.0) to convert images to gif. I read images from files, the problem is that when I convert 9 png files(each 50kb) to gif, it taks only 50ms. but when it turns to 9 jpg files (each 20kb), it takes 1900ms. What is the reason behind? How can I make it faster with jpg files?

Code: Select all

 for(int i = 2; i < argc-1; i++)
  {
    // I pass the file path from command line
    cout << argv[i] << endl;
    Image img(argv[i]);
    img.animationDelay(delay);
    img.magick("GIF");
    frames.push_back(img);
  }
  long mergestart = getCurrentTime();
  Magick::Blob tmpBlob;
  Magick::writeImages(frames.begin(), frames.end(), &tmpBlob);

Re: ImageMagick convert jpg images to gif being slow?

Posted: 2017-05-09T23:43:19-07:00
by snibgo
Perhaps your jpeg files have more colours than your png files, so colour-reduction takes longer.

Perhaps setting treedepth will increase speed (but probably lower quality).