iOS GIF very slow

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: iOS GIF very slow

Post 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.
stephenbaker
Posts: 1
Joined: 2012-08-01T15:07:56-07:00
Authentication code: 15

Re: iOS GIF very slow

Post 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!
jkrzemie
Posts: 2
Joined: 2012-12-22T08:09:25-07:00
Authentication code: 6789

Re: iOS GIF very slow

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: iOS GIF very slow

Post 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.
jkrzemie
Posts: 2
Joined: 2012-12-22T08:09:25-07:00
Authentication code: 6789

Re: iOS GIF very slow

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: iOS GIF very slow

Post 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.
Post Reply