Re: Reducing number of colors

"Bernhard R. Fischer" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Tuesday 02 July 2013 14:33:02 Chris Wilson wrote:
> On Tue, Jul 02, 2013 at 02:04:11PM +0200, Bernhard R. Fischer wrote:
> > 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.
> 
> The code you mention is src/cairo-xlib-surface.c when pushing images to
> X.  If both are truecolor, we use pixman to do the conversion (or failing
> that do the shifts ourselves). For other formats, we have a relatively
> simple mapping from r8g8b8 to the Visual's palette. That is a much
> simpler task than picking an optimal palette for an image.
> -Chris


Ok thanks. I'll have a look there.

Bernhard

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAABAgAGBQJR07KXAAoJEB2of8NcX/1HrdIH/2WJl1zy+Jvj3BELU34ptP1D
cGVJwGZMgEru0P+l8cP0C9XRqdSgfMMJukOvuTEI+biE1nVJdhHaYITxu1JLwQrW
3o/ogqjsrQZ2nyxNTMv3YMW4/0T9c6w5yQb4DhcRbP6Wn0ztzRB9ZXmX8fBIu23Y
5DT6JnaUXG9aO4t8j+uJwnjojXM9XSorv4+d0+EChPnVSvZ+GhgUoGn89astdRez
okptSe2YRQtQbGaAU6OVvjzWAxr/3Pgtu+N0Z2I4oeRynttKRe+BqtornsZXzftG
gWHVj0s4xsW6wjwYl8U1J0rKmArn9ljQXwptbsoBHbyeceKcu3QuzoH4gXhbg24=
=wPqK
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.