[jira] [Created] (BATIK-1288) PNG transcoder does not render PNG file correctly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Created] (BATIK-1288) PNG transcoder does not render PNG file correctly

Simon Steiner (Jira)
Mateusz created BATIK-1288:

             Summary: PNG transcoder does not render PNG file correctly
                 Key: BATIK-1288
                 URL: https://issues.apache.org/jira/browse/BATIK-1288
             Project: Batik
          Issue Type: Bug
    Affects Versions: 1.13
         Environment: MacOS Catalina 10.15.4, MacOS Mojave, both visible on MacBooks host systems as well as inside Virtual Machines

openjdk version "1.8.0_252"
OpenJDK Runtime Environment Corretto- (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM Corretto- (build 25.252-b09, mixed mode)
            Reporter: Mateusz
             Fix For: trunk
         Attachments: SaveAsPNG.java, correct.png, incorrect_output_1.png, incorrect_output_2.png, input.svg

Please consider such code I use for rendering PNG from SVG. We use it for rendering various icon sizes. The majority of sizes are rendered as expected (correct.png) but some are being rendered incorrect (especially 180 and 360). That affects only some environments - on the majority of our MacBooks it works fine for most trials and on VMs it usually results in incorrect PNG rendered as below. Also, I didn't notice it happening for any other text strings that the one from the sample (that obviously doesn't mean it is the only one causing that).

May I ask you to check if that is something to be considered a batik bug? Or, if not - please please point me any investigation directions in terms of my code correctness, possible environment issues worth checking? 




*Sample code:*


PNGTranscoder t = new PNGTranscoder()
 protected ImageRenderer createRenderer()
 ImageRenderer r = super.createRenderer();
 RenderingHints rh = r.getRenderingHints();
 rh.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
 rh.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON));
 rh.add(new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY));
 rh.add(new RenderingHints(RenderingHints.KEY_DITHERING,RenderingHints.VALUE_DITHER_DISABLE));
 rh.add(new RenderingHints(RenderingHints.KEY_FRACTIONALMETRICS,RenderingHints.VALUE_FRACTIONALMETRICS_ON));
 rh.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC));
 rh.add(new RenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY));
 rh.add(new RenderingHints(RenderingHints.KEY_STROKE_CONTROL,RenderingHints.VALUE_STROKE_PURE));
 rh.add(new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
 return r;

float size = 180.0f;
 // Set the transcoding hints.
 t.addTranscodingHint(PNGTranscoder.KEY_WIDTH, size);
 t.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, size);

// Create the transcoder input.
 String svgURI = new File(args[0]).toURI().toString();
 TranscoderInput input = new TranscoderInput(svgURI);

// Create the transcoder output.
 OutputStream ostream = new FileOutputStream("out.png");
 TranscoderOutput output = new TranscoderOutput(ostream);

// Save the image.
 t.transcode(input, output);




This message was sent by Atlassian Jira

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]