You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Dretio El Rey <dr...@gmail.com> on 2010/01/05 17:45:13 UTC

Export or rasterize SVG with embedded SVG's

Dear batik users,
this could be the wrong place but here I go :

Goal
I'm trying to have a rasterized file (Jpg, tiff, ...)  from an SVG with
embedded SVG's (xlink).
These files should be "print ready" so we are talking about 300 dpi, or 5000
x 5000 px in 72 dpi.
This generation should be done "dummie proof" if possible with an .exe

Problem
The only program that correctly displays this kind of files is
batik/squiggle. (even Inkscape doesn't support this)
I can't use the Squiggle rasterizer because it asks to much memory to
generate my files for a "print ready" file. (tested with 2 Gig)

Question
What would be the right way to do this? (PDFrasterizer, etc..)

I am struggling for 1 month now, so many thanks!

Andries

Re: Export or rasterize SVG with embedded SVG's

Posted by Helder Magalhães <he...@gmail.com>.
Hi Andries,


> Dear batik users,
> this could be the wrong place but here I go :

This is the right place [1] for this sort of questions. :-)

You can/should also take a look at the Apache FOP [2] project, given
it's level of specialty for typography/printing-related operations
(PDF support and more).


> Goal
> I'm trying to have a rasterized file (Jpg, tiff, ...)  from an SVG with
> embedded SVG's (xlink).
> These files should be "print ready" so we are talking about 300 dpi, or 5000
> x 5000 px in 72 dpi.

Note that this sort of images *will* have large memory requirements.
So, in this case, just for the image buffer we will need 5000 * 5000 *
4 = 100000000, which is 100MB. The 4 multiplier stands for 4 bytes, as
each pixel has 32 bit information (RGB + transparency). Take a look at
a post by Jeremias [3] explaining the calculations in more detail.


> This generation should be done "dummie proof" if possible with an .exe

Creating a single executable can become tricky, given the need of a
JVM and Batik. But an installer for installing the prerequisites that
and a batch script for the task (I'm assuming Windows given ".exe")
would be fairly easy. You may be interested in taking a look at the
"Installing Batik on Windows Systems" tutorial (link in the Batik wiki
[4]).


> Problem
> The only program that correctly displays this kind of files is
> batik/squiggle. (even Inkscape doesn't support this)

Note that, regarding TIFF and other image formats support, Inkscape
(and other SVG viewers) are not required to support them: only JPEG
and PNG are mandatory [5].


> I can't use the Squiggle rasterizer because it asks to much memory to
> generate my files for a "print ready" file. (tested with 2 Gig)

Humm... This sounds like it *could* be root cause the problem. You are
testing with 2GB of heap space or in a machine with 2GB of RAM? This
is quite different (and probably you already know it, but confirming
is always good). Taken from a bug comment [6], I'd suggest increasing
the memory provided to Batik using something like:

java -Xmx1024m -jar batik-rasterizer.jar ...

In order to possibly reduce memory consumption, you may also take a
look at the "bg" option [7], which allows removing the transparency
from the output (if it's not a requirement). I haven't tested if Batik
internally optimizes that (i.e., if it actually will lead to memory
savings) but it may worth testing. ;-)


> Question
> What would be the right way to do this? (PDFrasterizer, etc..)

I guess you now have plenty information available... ;-)

Nevertheless, if you end up concluding that FOP and/or Batik don't
suit your needs, I'd suggest also taking a look at ImageMagick [8],
which also seems to be worth a try given its scripting abilities and
such. ;-)


> I am struggling for 1 month now, so many thanks!
>
> Andries

Don't struggle for so long before asking! I confess I also tend to do
that (struggle a lot before asking) but, if one crawled through the
Web/mailing lists/available documentation and found nothing
appropriate, then posing a smart question at that point is generally a
good idea IMO. (It doesn't mean to stop struggling, just inviting
others to be part of the process.) ;-)

Hope this helps,
 Helder


[1] http://xmlgraphics.apache.org/batik/mailing-lists.html#batik-users
[2] http://xmlgraphics.apache.org/#fop
[3] http://old.nabble.com/PDFTranscoder-Text-Opacity---Transcoding-Hints-td22874236.html#a22985225
[4] http://wiki.apache.org/xmlgraphics-batik/
[5] http://www.w3.org/TR/SVG/conform.html#ConformingSVGViewers
[6] https://issues.apache.org/bugzilla/show_bug.cgi?id=43369#c3
[7] http://xmlgraphics.apache.org/batik/tools/rasterizer.html#using-binary
[8] http://www.imagemagick.org/

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