Page 1 of 1

support for 128-color palette GIF?

Posted: 2009-10-09T09:24:35-07:00
by roach
I need to downsample an 8bit GIF file to a 7bit palette, in order to make the file smaller. I don't mean just changing the number of colors used in the image, I mean changing the size of the palette in the physical image file.

This may be a silly question, but is there any way to export (with "convert") a GIF image with a 128-color palette, rather than 256? I've tried using

Code: Select all

convert 8bit.gif -depth 7 7bit.gif
But the resulting image is actually LARGER (filesize in Kb) than the original, 8-bit image.

Is there a particular compression setting, or maybe a dithering strategy I can use that will optimize well for the LZH compression?

Re: support for 128-color palette GIF?

Posted: 2009-10-09T21:22:36-07:00
by fmw42
I am not an expert on GIF, but does GIF even support 7-bit palette?

You could look at some of the other non-IM GIF apps. See http://www.imagemagick.org/Usage/formats/#gif_non-im

Testing:

convert logo: -depth 8 logo8.gif
identify -verbose logo8.gif
Image: logo8.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
...
Colormap: 256
...
Filesize: 37.4KiB



convert logo: +dither -colors 128 logo7.gif
identify -verbose logo7.gif
Image: logo7.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
...
Colormap: 128
...
Filesize: 32.1KiB

So the file size is smaller with -colors 128

Re: support for 128-color palette GIF?

Posted: 2009-10-11T19:49:08-07:00
by anthony
output GIF images will automatically use a smaller palette size if the number of colors is less that that palette size.

For example 128, 64, 32, ... 2 color palettes are all handled correctly.

A verbose identify will also show the palette size being used.