convert PNG to GIF results in bigger files

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?".
Post Reply
moo

convert PNG to GIF results in bigger files

Post by moo »

Hello,

I'm trying to convert a series of PNG images into GIF, but the resulting files are 4 times bigger:

test.png -> 4.6K

$ convert test.png test.gif

test.gif -> 21K

even if I do:
$ convert test.png -colors 128 test.gif
still the resulting gif file is 19K.

Is there a way to extract the color palette from the PNG file and use that palette for the GIF or something similar that would produce good results?

Thanx.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert PNG to GIF results in bigger files

Post by anthony »

PNG only has a palette in certain conditions. and will use that palette is the image is unchanged.

Try adding -compress LWZ and see if that fixes the problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
moo

Re: convert PNG to GIF results in bigger files

Post by moo »

Hi anthony,

Thanx for the hint.
Apparently I have an older version of IM where LZW compression wasn't compiled in. upgrading IM fixed it.

Regards,
Post Reply