How to LZW compression for Gif

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

All IM operators are applied to all images in sequence. The exceptions are generally obvious as they use mulitple images. The only special one is -geometry with was defined as being a resize for the last image only.

Basically all operators work on all images in memory. You can limit the effect to just a specific image by creating a seperate image sequence using parenthesis.

See Basics, and 'Frame-byFrame' modification in Animation Modifications.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
abhishekv1

Post by abhishekv1 »

Hi,

I am getting a very good output now. The file size of the resized animations are optimized enough.
But I have still one confusion that has foxed me.
I have written a script in Php for an interface which lets you enter the dimensions and the program generates the resized content using ImageMagick.
When I fired these two commands via script and commandline seperately, I got output with diff file sizes:

to convert 375x500 to 240x320 :-

/usr/local/bin/convert 'PartyBaloon_375x500.gif' -coalesce -antialias -scale 240x320! \( -clone 0--1 -append -colors 256 -write 'colormap_240x320.gif' +delete \) -map 'colormap_240x320.gif' -layers optimize 'PartyBaloon_240x320.gif'
/usr/local/bin/gifsicle -b --careful -O2 'PartyBaloon_240x320.gif'

The same command via script gives me 236KB
The same command via commandline gives me 215KB.

That's 21KB less
Can you understand why there should be the difference?

Regards,
Abhishek
Post Reply