You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Huang Haitao-G17843 <ha...@motorola.com> on 2002/08/13 17:22:51 UTC

How do I encode SVG into PNG with lower color depth

Hi,
The default color depth used by PNG transcoder is 16. I wonder if there is a way to change it to lower value such as 1,2,4?
Thanks for any help.
Haitao Huang


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


How do I encode SVG into PNG with lower color depth

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "HH" == Huang Haitao-G17843 <ha...@motorola.com> writes:

HH> The default color depth used by PNG transcoder is 16. 

    Actually the default depth is 24/32 bits per pixel.  You
can have it write an 'indexed' PNG that uses 256 colors or 8 bits
with the -indexed parameter.

HH> I wonder if there is a way to change it to lower value such as
HH> 1,2,4?  Thanks for any help.  Haitao Huang

    Currently there is no interface for this although it should be
fairly trivial to add (all the support is there, the glue code etc
just hasn't been written).  If this is interest to you I suggest you
look at 'batik.transcoder.image.PNGTranscoder' and
'batik.ext.awt.image.rendered.IndexImage').

    Basically you would want to make the KEY_INDEXED hint an integer
(defaulting to 256), and have IndexImage take this number as the
number of color cubes to generate (256 is hardcoded in a few places).

    Good luck.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org