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 Захаров Сергей <cy...@2energies.com> on 2009/03/30 11:41:53 UTC

Extract more than 1000 areas fron svg

Hello!

 

I have big SVG file about 2300x3200 dimension and I want get little areas
from it and save them to jpg but my problem is in slow transcode of each
area.

I think this trouble because every time all svg file upload to memory. How
can I save it in memory until getting areas.

 

Regards,
Sergey

Re: Extract more than 1000 areas fron svg

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

> I have big SVG file about 2300x3200 dimension and I want get little areas
> from it and save them to jpg but my problem is in slow transcode of each
> area.

You don't provide much background: are you using the SVG Rasterizer
[1] for this...?


> I think this trouble because every time all svg file upload to memory. How
> can I save it in memory until getting areas.

Probably to support this somehow specific use pattern you'll need to
extend Batik, so that it holds the SVG document while producing the
several interest areas raster versions. Why not consider a
contribution afterward? ;-)

I recall a few related possibly rasterizer related threads so you may
want to spend a bit more searching the archives (I find Nabble [2] a
bit more user friendly than the official archive [3]). I assume you
already tried doing it, of course [4]. ;-)

Finally, you may consider using the Rasterizer Ant task [5] for that
(as you haven't gave any information, I must make a guess that you are
not). Although I haven't confirmed, I imagine it probably doesn't
support several areas per image, but this may boost the performance
quite a bit as the Java runtime engine will be kept in memory - using
the rasterizer [1] you will have the additional overhead of loading
the JVM for each image.


Please provide more information on what you intend and how are you
trying to accomplish it in order to get more valuable feedback. :-)

Hope this helps,
 Helder


[1] http://xmlgraphics.apache.org/batik/tools/rasterizer.html
[2] http://www.nabble.com/Batik-f308.html
[3] http://xmlgraphics.apache.org/batik/mailing-lists.html
[4] http://www.catb.org/~esr/faqs/smart-questions.html#before
[5] http://xmlgraphics.apache.org/batik/tools/rasterizer.html#task

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


Re: Extract more than 1000 areas fron svg

Posted by th...@kodak.com.
Hi Sergey,

Захаров Сергей <cy...@2energies.com> wrote on 03/30/2009 05:41:53 AM:

> I have big SVG file about 2300x3200 dimension and I want get little 
> areas from it and save them to jpg but my problem is in slow 
> transcode of each area.
> I think this trouble because every time all svg file upload to 
> memory. How can I save it in memory until getting areas.

    A lot of how to approach this depends on what support you
need.  The simplest approach would be to take the 'Boot SVG and CSS DOM'
code which will build the GVT tree.  Then you can create your tile
as a BufferedImage get a Graphics2D from that BufferedImage.

    You can then translate the Graphics2D and call the paint method
on the root GraphicsNode - this will fill the BufferedImage with the
related Image content.  You can then encode the BufferedImage translate
the Graphics2D and call paint again...

    This of course doesn't benefit from viewBox fitting, or setting
any rendering hints but it's the simplest way to get control of the
rendering of an SVG document.