0

I have an image of a cartoon, which only has 4 colors (when not anti-aliased).

Is there an image format that analyses the color palette of the image, and compresses it heavily because it only has a few colors? Something like dynamic palette image compression.

Such an image format will be useful in cases when there are only a few colors in the image. The header of the image data should specify the colors used in the image and name them say 0,1,2,3 So now the 2d matrix of image color will contain only 2 bit values which was display a 16 bit value previously. But can display the image without any loss.

penduDev
  • 4,743
  • 35
  • 37

1 Answers1

0

Image format depends on many things (eg. size, number of colours, device viewing it), just picking it by the number of colours might not give you the smallest/most useable image.

Here is a wiki article comparing many: http://en.wikipedia.org/wiki/Image_file_formats.

Whilst that wiki doesn't give you a format that will only do 4 colours, one of the better suggestions is probably using PNG as this has support for different sized palettes: "The PNG file format supports 8 bit paletted images (with optional transparency for all palette colors) and 24 bit truecolor (16 million colors) or 48 bit truecolor with and without alpha channel - while GIF supports only 256 colors and a single transparent color." - from wiki

Matt
  • 81
  • 1
  • 6
  • Thanks Matt, I have updated the question to make it more clear, what I'm looking for. I will check the wiki page you suggested – penduDev Dec 26 '14 at 20:48
  • something to consider is where you are going to use the image (eg. web) not all browsers support all file formats (eg. svg support in old browsers isn't good). You might find a happy compromise in one of the above though. – Matt Dec 26 '14 at 20:54