OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Converting SVG to PNG


Hi,

I decided to try batik as a tool for converting images created with Inkscape 
into png.

In my ANT build I am calling batik to raster all PNG files in a given 
directory, like this:

<java jar="${batik.dir}/batik-rasterizer.jar" 
classpathref="project.class.path.batik" output="batik.log" fork="true">
	<jvmarg value="-Xmx256m"/>
	<arg line="-d ../build/images"/>
	<arg line="-m image/png"/>
	<arg line="-bg 255.255.255.255"/>
	<arg line="-dpi 300"/>
	<arg line="../images"/>
</java>

While batik produces great images I have the following problem.

The image created includes the drawing (vectors) and a huge, I mean huge, 
amount of whitespace. So according to the batik documentation I need a 
viewport. So I add
	<arg line="-a 0,0,452,320"/>
to the command above.

This generates only the image showing in the rectangle defined. The problem is 
that not all pictures are exactly this size. Some are larger and some are 
smaller.

Has anyone found a way of dynamically extracting the size and location of the 
vector image from an Inkscape SVG and passing them to batik.

I know this is not directly docbook related, but the batik-users list is not 
giving much since they are not much concerned with this type of use case. I 
am hoping that somebody else has experimented with this in content of docbook 
with ant and can help.

Prior to trying to use batik I would use inkscape from the command line to 
look through images and export them to PNG. This worked very well, no extra 
white space or view ports needed. I may have to revert back to this system, 
but it is a process executed outside of the ant build. 

Many thanks,

-- 
Sean Wheller
Technical Author
email: sean@inwords.co.za
im: seanwhe@jabber.org
skype: seanwhe
cel: +27-84-854-9408
web: http://www.inwords.co.za


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]