On Thursday, May 26, 2011, 3:52:56 PM, marting wrote: m> I have a couple of PNGs with 8-bit red/green/blue channels and a m> 1-bit alpha channel, equating to what is a transparent bitmasked m> image (rather than translucent)
m> So my question is has my paint program (Paint.NET on Windows 7) generated a m> bad PNG, Yes, it has. From http://www.w3.org/TR/PNG/#6AlphaRepresentation =============== start quote ====================== In a PNG datastream transparency may be represented in one of four ways, depending on the PNG image type (see 4.3.2: Alpha separation and 4.3.5: Alpha compaction). Truecolour with alpha, greyscale with alpha: an alpha channel is part of the image array. Truecolour, greyscale: A tRNS chunk contains a single pixel value distinguishing the fully transparent pixels from the fully opaque pixels. Indexed-colour: A tRNS chunk contains the alpha table that associates an alpha sample with each palette entry. Truecolour, greyscale, indexed-colour: there is no tRNS chunk present and all pixels are fully opaque. An alpha channel included in the image array has 8-bit or 16-bit samples, the same size as the other samples. The alpha sample for each pixel is stored immediately following the greyscale or RGB samples of the pixel. An alpha value of zero represents full transparency, and a value of 2^sampledepth - 1 represents full opacity. =========== end quote =============== So if you use an alpha channel, it has the same sample depth as the RGB data. This is because it is interleaved with the RGB data and the whole lot is compressed as one block. If you have a single 'transparent colour' then that can be expressed with tRNS. If you have a 1-bit mask which is independent of the RGB colours then the software must expand that mask to the bit depth of the RGB data (8 or 16 bits) before constructing the RGBA array. This ensures that the RGB data is byte or word aligned, which will improve compression. I would be grateful if you would send me a sample PNG image that shows this, along with details (version etc) of the software that wrote it. m> or is this a bug in batik? Its not a bug in Batik. -- Chris Lilley Technical Director, Interaction Domain W3C Graphics Activity Lead, Fonts Activity Lead Co-Chair, W3C Hypertext CG Member, CSS, WebFonts, SVG Working Groups --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org