ImageMagick convert jpg images to gif being slow?

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
royxr
Posts: 4
Joined: 2017-05-02T22:28:30-07:00
Authentication code: 1151

ImageMagick convert jpg images to gif being slow?

Post by royxr » 2017-05-09T22:25:03-07:00

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);

snibgo
Posts: 9382
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick convert jpg images to gif being slow?

Post by snibgo » 2017-05-09T23:43:19-07:00

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).
snibgo's IM pages: im.snibgo.com

Post Reply