[xep-support] Re: Output to image

From: Jan To¹ovskı <j.tosovsky@gmc.net>
Date: Wed Nov 06 2013 - 23:35:35 PST

Alternatively you can use:

1. Batik rasterizer - http://xmlgraphics.apache.org/batik/tools/rasterizer.html
java -jar batik-rasterizer.jar -d output -m image/png *.svg
(converts all svg images in the folder into the output folder)

2. PhantomJS - http://phantomjs.org/ - it contains rasterize.js script for this

phantomjs.exe rasterize.js my.svg my.png

PhantomJS uses the WebKit engine under the hood so it can support all SVG features you can display in the browser. I've recently switched to it as Batik could not process advanced mask and filters in my files.

Jan

From: xep-support-bounces@renderx.com<mailto:xep-support-bounces@renderx.com> [mailto:xep-support-bounces@renderx.com] On Behalf Of Kevin Brown
Sent: Thursday, 7 November 2013 10:14 AM
To: 'RenderX Community Support List'
Subject: [xep-support] Re: Output to image

If the SVGs are on disk ... and they contain the width/height information inside ... here's a little trick XSL .. makes a PDF that is only the SVG.

You could run all SVGs to PDF and then all PDFs to image ...

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:svg="http://www.w3.org/2000/svg"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <xsl:template match="svg:svg">
    <fo:root>

      &l t;fo:layout-master-set>
        <fo:simple-page-master master-name="svgimage">
          <xsl:attribute name="page-width"><xsl:value-of select="@width"/></xsl:attribute>
          <xsl:attribute name="page-height"><xsl:value-of select="@height"/></xsl:attribute>
          <fo:region-body margin="0cm"/>
        </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="svgimage">
        <fo:flow flow-name="xsl-region-body">
          <fo:block line-height="0">
            <fo:instream-foreign-object>
              <xsl:copy-of select="."/>
            </fo:instream-foreign-object>
          </fo:block>
        </fo:flow>
&nb sp; </fo:page-sequence>

    </fo:root>

  </xsl:template>

</xsl:stylesheet>< /p>

!DSPAM:87,527b44159851496120170!

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Wed Nov 6 23:41:12 2013

This archive was generated by hypermail 2.1.8 : Wed Nov 06 2013 - 23:41:33 PST