Page 2 of 2

Re: iOS GIF very slow

Posted: 2012-05-27T12:58:04-07:00
by magick
> I failed to separate the color quantization from the dithering

The GIF encoder reduces the color palette to 256 colors or less as required by the GIF image format. To control how the color reduction is performed, you'll want to call MagickQuantizeImage() before you write the GIF image. You now have 3 timing tests: 1) WriteImage() only; 2) MagickQuantizeImage() with dithering enabled then WriteImage(); and finally 3) MagickQuantizeImage() without dithering enabled then WriteImage(). If the least time is MagickQuantizeImage() without dithering, the problem may be recursion. Riemersma dithering uses recursion which may not be efficient on an ARM processor.

Re: iOS GIF very slow

Posted: 2012-08-01T15:21:44-07:00
by stephenbaker
Curious if anyone has had any luck here. I've found that calling MagickQuantizeImage(...) per image added greatly reduces the about of time calling MagickGetImagesBlob(...) when writing the GIF at the end, but the net effect is still about the same amount of time – 6 to 8 seconds per 320x480 frame on an iPhone 4. I don't see notice a difference between dithering enabled or disabled.

Code: Select all

MagickQuantizeImage(localWand,255,RGBColorspace,0,MagickFalse,MagickFalse);
Reducing the number of colors down to 16 or 4 speeds things up, but I'd like to use the full 256 colors. I'd also like to try the color reduction code from Rosetta per the previous post, but haven't had luck yet.

Any leads are greatly appreciated!

Re: iOS GIF very slow

Posted: 2012-12-22T16:39:41-07:00
by jkrzemie
Hi, has anyone made any progress regarding this issue?
MagickQuantizeImage takes almost a sec for each image (dithering doesn't change execution time), MagickGetImagesBlob is very fast afterwards - so the bottleneck is definately quantizing.

Re: iOS GIF very slow

Posted: 2012-12-22T16:46:57-07:00
by magick
ImageMagick is about the quality of the results first, then performance. We could substitute a fast algorithm that returns less promising results but that violates the quality requirement of ImageMagick's design goals.

Re: iOS GIF very slow

Posted: 2012-12-23T12:48:13-07:00
by jkrzemie
I am all about quality but 1s / image on an iphone 5 is just extremely slow. What do you suggest to get better performance?

Re: iOS GIF very slow

Posted: 2012-12-23T16:05:58-07:00
by magick
We have no specific recommendations. ImageMagick in general is very fast, but it is slow for color reduction -- color reduction is a complex operation when done properly (see http://www.imagemagick.org/script/quantize.php). You can shortcut the algorithm, its faster but the results are far from ideal:
  • convert myimage.jpg -treedepth 3 -colors 256 myimage.gif
Now try a tree depth of 4 or 5.