You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Chris Lilley <ch...@w3.org> on 2010/06/22 22:31:00 UTC
16-bit per compent PNGs wrong in Batik
Hello batik-dev,
PNG images with 16 bits per component (whether greyscale, rgb, greyscale with alpha, or rgb with alpha), referenced from an SVG file, seem to render incorrectly in Batik.
As an example, see these three tests. The 'reference image' in wrong, and is generated by Batik. Opera and Firefox produce the correct rendering
http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-13-f.html
http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-14-f.html
http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-15-f.html
The third test also indicates an issue with transparency (tRNs) in Batik
Direct links to the svg files
http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-13-f.svg
http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-14-f.svg
http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-15-f.svg
--
Chris Lilley mailto:chris@w3.org
Technical Director, Interaction Domain
W3C Graphics Activity Lead
Co-Chair, W3C Hypertext CG
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
Re: 16-bit per compent PNGs wrong in Batik
Posted by Raik Nagel <ra...@spreadshirt.net>.
Hi,
we use a patched version of batik which scales such images down to 8bit
per color/channel. This is not nice but it works for us.....
We replace the lines (somewhere between 1800 and 1850) :
// Copy data into passRow byte by byte
if (bitDepth < 16) {
....
} else {
int idx = 0;
for (int j = 0; j < eltsPerRow; j++) {
shortData[j] =
(short)((curr[idx] << 8) | (curr[idx + 1] & 0xff));
idx += 2;
}
}
in decodePass methode of org.apache.batik.ext.awt.image.codec.png.PNGRed by
if (bitDepth < 16) {
....
} else if (decodeParam.isReduceTo8Bit()) {
// use only the higher 8bit for color
for (int j = 0, idx=0; j < eltsPerRow; j++,idx+=2) {
shortData[j] = (short)(curr[idx] & 0xff);
}
} else
We have some other patches (better quality) for cmyk JPGs, BMP and GIF
images. Which is the prefered way for commiting this changes into the
batik code base?
raik
> Hello batik-dev,
>
> PNG images with 16 bits per component (whether greyscale, rgb, greyscale with alpha, or rgb with alpha), referenced from an SVG file, seem to render incorrectly in Batik.
>
> As an example, see these three tests. The 'reference image' in wrong, and is generated by Batik. Opera and Firefox produce the correct rendering
>
> http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-13-f.html
> http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-14-f.html
> http://dev.w3.org/SVG/profiles/1.1F2/test/harness/htmlObject/struct-image-15-f.html
>
> The third test also indicates an issue with transparency (tRNs) in Batik
>
> Direct links to the svg files
>
> http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-13-f.svg
> http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-14-f.svg
> http://dev.w3.org/SVG/profiles/1.1F2/test/svg/struct-image-15-f.svg
>
>
--
Raik Nagel
sprd.net AG
Gießerstraße 27
04229 Leipzig
Germany
Vorstand/Executive Board: Jana Eggers (Vorsitzende/CEO), Matthias Spieß, Tobias Schaugg
Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Lukasz Gadowski
Handelsregister/Trade Register: Amtsgericht Leipzig, HRB 22478
Umsatzsteuer-IdentNummer/VAT-ID: DE 8138 7149 4
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org