1

I am having to use the imagemagick PHP API, imagick, and find that my attempts to compress a GIF image are having no effect.

Here are the commands I am using:

    $_image = new Imagick( $image_url );
    $_image->setImageFormat( $type ); // can be GIF or JPEG     
    $_image->setImageCompressionQuality( $level ); // Any of 20, 40, 60, 80, 100

I get good results when using a jpeg, but nothing whatsoever when converting to a GIF and then trying to compress. Could it be something to do with the conversion?

Maybe I have to use a certain compression type for GIF's? eg:

    $_image->setImageCompression( imagick::COMPRESSION_...?? );

If anyone has any clues, then please help me out, as the documentation for this API is woeful.

Thanks!

Ste77
  • 676
  • 1
  • 7
  • 21
  • 1
    GIFs don't support compression in order to reduce quality in the way JPEG files do - they use LZW lossless compression or nothing. In general, GIFs can only compress large areas of constant colour well - such as Computer Generated Graphics - but not life-like photos. – Mark Setchell Feb 10 '15 at 16:33
  • Ok, thanks Mark - it seems that a general misunderstanding on my part is the fault here. I'll go and read up. – Ste77 Feb 11 '15 at 07:59

0 Answers0