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 "Erich Schubert (JIRA)" <ji...@apache.org> on 2016/06/13 13:40:21 UTC

[jira] [Commented] (BATIK-818) TranscoderException and EnclosedException when transcoding SVG to JPEG

    [ https://issues.apache.org/jira/browse/BATIK-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15327385#comment-15327385 ] 

Erich Schubert commented on BATIK-818:
--------------------------------------

This most certainly is BATIK-1111 again:
> Essentially: the Maven packages do not include working PNG/TIFF/JPEG export.

But unfortunately, nobody pulled the patches there yet, and build a correct package.

Let me emphasize: The packages on Maven were built WITHOUT working PNG/TIFF/JPEG support.

It's easy to fix (just a few lines), but requires a new version to be built and uploaded.

> TranscoderException and EnclosedException when transcoding SVG to JPEG
> ----------------------------------------------------------------------
>
>                 Key: BATIK-818
>                 URL: https://issues.apache.org/jira/browse/BATIK-818
>             Project: Batik
>          Issue Type: Bug
>          Components: SVG Rasterizer
>    Affects Versions: 1.8
>         Environment: Operating System: Linux
> Platform: PC
>            Reporter: ks
>            Assignee: Batik Developer's Mailing list
>
> Hi,
> when I try to follow the description on
> http://xmlgraphics.apache.org/batik/using/transcoder.html#createImage
> to create a jpg-image file from a svg-file in a JUnitTest, I get the following error message:
>  
> org.apache.batik.transcoder.TranscoderException: null
> Enclosed Exception:
> null
> 	at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:132)
> 	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
> 	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
> 	at de.vitronic.test.TestJPEGTranscoder.testJPEGTranscoder(TestJPEGTranscoder.java:57)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> The batik version I use is 1.7.
> First I tried to transform a created svg-file into jpeg-file in my own application, but I get the same exception, so I copied the example code from the previous mentioned website in a JUnit-Testcase to figure out if I have done anything wrong in my application. But I got the same problem again, with the copied and pasted code (see above).
> When I ran the rasterizer.jar file to convert the image, there is no such an exception thrown. I looked at the code from SVGGenerator from the Rasterizer application, but I doesn´t found a solution, so far to solve the problem.
> So here is the code from my JUnitTest method:
>     public void testJPEGTranscoder() {
> 	// Create a JPEG transcoder
> 	JPEGTranscoder t = new JPEGTranscoder();
> 	// Set the transcoding hints.
> 	t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));
> 	// Create the transcoder input.
> 	String svgURI;
> 	try {
> 	    svgURI = new File("test/TestInput.svg").toURL().toString();
> 	    TranscoderInput input = new TranscoderInput(svgURI);
> 	    // Create the transcoder output.
> 	    OutputStream ostream = new FileOutputStream(
> 		    "test/TestOutput.jpg");
> 	    TranscoderOutput output = new TranscoderOutput(ostream);
> 	    // Save the image.
> 	    t.transcode(input, output);
> 	    // Flush and close the stream.
> 	    ostream.flush();
> 	    ostream.close();
> 	    // System.exit(0);
> 	} catch (MalformedURLException e) {
> 	    // TODO Auto-generated catch block
> 	    e.printStackTrace();
> 	} catch (FileNotFoundException e) {
> 	    // TODO Auto-generated catch block
> 	    e.printStackTrace();
> 	} catch (TranscoderException e) {
> 	    // TODO Auto-generated catch block
> 	    e.printStackTrace();
> 	} catch (IOException e) {
> 	    // TODO Auto-generated catch block
> 	    e.printStackTrace();
> 	}
>     }
> Thanks in advance for your help,
> ks



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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