[cairo] Reducing number of colors

Bernhard R. Fischer bf at abenteuerland.at
Tue Jul 2 05:04:11 PDT 2013

On Tuesday 02 July 2013 13:27:00 Chris Wilson wrote:
> On Tue, Jun 25, 2013 at 08:16:22AM +0200, Bernhard R. Fischer wrote:
> > Hi!
> > 
> > Image surfaces are supported as true color (24/32 bit) or 5/6/5 bit
> > pixels.
> > 
> > Is there any native way in cairo to reduce colors to fixed number palette
> > image?
> No, there is nothing inside cairo to perform the quantization you wish -
> it is outside of Cairo's scope.  I would suggest you hook the output of
> your rendering into ImageMagick and use some of its routines to control
> the quantization of the image to a fixed palette.
> -Chris

Hi Chris,

I think that there is some code somwhere which could be used for that purpose 
because it is possible to copy a 24 bit surface to a 16 bit surface which 
obviously requires color reduction.

I already implemented my version of color reduction using the median cut 
algorithm. I'll publish that soon if someone else needs it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130702/627144a5/attachment.pgp>

More information about the cairo mailing list