question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SVGImageReader: Can't overwrite cause with java.awt.image.ImagingOpException: Unable to transform src image

See original GitHub issue

Some SVG files cause an exception in TwelveMonkeys:

java.lang.IllegalStateException: Can't overwrite cause with java.awt.image.ImagingOpException: Unable to transform src image
	at java.lang.Throwable.initCause(Throwable.java:457)
	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.readImage(SVGImageReader.java:538)
	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.getImage(SVGImageReader.java:562)
	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.access$200(SVGImageReader.java:262)
	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader.read(SVGImageReader.java:141)
	...

This is because the TranscoderException already initializes the throwable cause with null and thus initCause cannot be called:

            catch (Exception ex) {
                TranscoderException exception = new TranscoderException(ex.getMessage());
                exception.initCause(ex);
                throw exception;
            }

So it should be changed into something like this:

            catch (Exception ex) {
                TranscoderException exception = new TranscoderException(ex.getMessage(), ex);
                throw exception;
            }

Alright, but this is not such a big issue. What worries me is the original exception to begin with: java.awt.image.ImagingOpException: Unable to transform src image

Now, since you are using an ARGB image already, this seems to be a Batik bug that it in turn seems to be caused by a Java bug (see this)…

The images that cause these exceptions are in the Batik sample folder as follows: batikYin.svg logoShadowOffset.svg textRotateShadows.svg

The problem (at least in the examples above, there may be other triggers) goes way if you edit the feGaussianBlur’s stdDeviation parameter in the XML to use only one argument.

For example, this causes the exception: <feGaussianBlur stdDeviation="2 3" />

but this does not: <feGaussianBlur stdDeviation="2" />

I don’t think there is much that can be done to fix the ImagingOpException but it is just to let you know : )

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
j-p-sequeiracommented, Oct 23, 2018

Well, it does work in OpenJDK 9 in Linux!!

0reactions
haraldkcommented, Oct 23, 2018

Excellent. Closing this (I will probably fix the exception issue at some point though).

– Harald K

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange behaviour of java AffineTransformOp - Stack Overflow
The line marked with 1 throws an ImagingOpException:Unable to transform src image . But I comment out that line, then the next line...
Read more >
AffineTransformOp -> ImagingOpException: Unable to ...
AffineTransformOp -> ImagingOpException: Unable to transform Image ... Hello, I'm trying to resize a BufferedImage with the AffineTransformOp, in ...
Read more >
java.awt.image.ImagingOpException: Unable to transform src ...
AffineTransformOp.filter throws a java.awt.image.ImagingOpException: Unable to tranform src image when a PixelInterleavedSampleModel is used.
Read more >
[PATCH] ImagingOpException when rasterizing simple SVG ...
ImagingOpException : Unable to transform src image at java.awt.image.AffineTransformOp.filter(Unknown Source) at ...
Read more >
Error "Unable to convolve src image" - yEd Q&A
The error dialog pops up and shows the following error message: "java.awt.image.ImagingOpException: ... ) at y.I.DA.paintComponent(Unknown Source)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found