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/12/21 21:48:59 UTC
[jira] [Comment Edited] (BATIK-1111) SVG to PNG
[ https://issues.apache.org/jira/browse/BATIK-1111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15768235#comment-15768235 ]
Erich Schubert edited comment on BATIK-1111 at 12/21/16 9:48 PM:
-----------------------------------------------------------------
The bug fixes is linked just above.
Somebody with write access needs to apply them, build a new release, and upload to maven.
As a workaround for PNG (only) place this file in META-INF/services on your classpath before batik:
https://github.com/elki-project/elki/blob/master/addons/batikvis/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.ImageWriter
Because of the registry bug, it must be the first ImageWriter service file on your classpath; and because the other codecs (jpeg etc.) weren't compiled the same trick won't work for them.
Do the same thing with registryentry if you have pngs in your svg.
was (Author: erich.schubert):
The bug fixes is linked just above.
Somebody with write access needs to apply them, build a new release, and upload to maven.
> SVG to PNG
> ----------
>
> Key: BATIK-1111
> URL: https://issues.apache.org/jira/browse/BATIK-1111
> Project: Batik
> Issue Type: Bug
> Reporter: Andrey
> Priority: Blocker
> Attachments: noValid.png, valid.png
>
>
> I try transcode SVG to PNG
> {code:title=Bar.java|borderStyle=solid}
> public byte[] svgToPNG(String svg) {
> TranscoderInput transcoderInput = new TranscoderInput(new StringReader(svg));
> ByteArrayOutputStream output = new ByteArrayOutputStream();
> TranscoderOutput transcoderOutput = new TranscoderOutput(output);
> PNGTranscoder pngTranscoder = new PNGTranscoder();
> try {
> pngTranscoder.transcode(transcoderInput, transcoderOutput);
> } catch (TranscoderException e) {
> LOGGER.error(e.getMessage(), e);
> }
> return output.toByteArray();
> }
> this._getSvgStringAp = function ($mapSvg) {
> if ($mapSvg[0] === undefined){
> return "";
> }
> var svgDomNode = $mapSvg[0];
> var svgXML = (new XMLSerializer()).serializeToString(svgDomNode);
> return svgXML;
> };
> {code}
> In my SVG i have marker:
> <image xlink:href="/img/mypath/..." ...></image>
> But in transcode error:
> org.apache.batik.transcoder.TranscoderException: null
> Enclosed Exception:
> null:0
> The URI "http://localhost/img/mgm/71094611/71094691/2"
> on element <image> can't be opened because:
> The URI can't be opened:
> Server returned HTTP response code: 500 for URL: http://localhost/img/mgm/71094611/71094691/2
> This situation only novalid.png.
> Valid.png - it's ok
--
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