xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hermans <paul_herm...@protext.be>
Subject RE: request : optimising size of generated PNG by the SVG Rasteri zer
Date Mon, 16 Jul 2001 12:47:11 GMT
Thanks for the clarification but my reasoning is as follows.

The Batik rasterizer takes the SVG definitions (vectors) and generates a
bitmap out of it
(in our case a png).
Now this bitmap can be searched for the lowest left pixel different from the
and the highest right pixel different from the background.
Those two points can be used to define the width and the heigth of the png
with maybe a few pixels added at each side.

This is what the product WebEQ does going from MathML to PNG renditions of
mathematical formulas.
The width and height of the generated png is depending on the result of the
rendering of the formula.



-----Original Message-----
From: Thierry Kormann [mailto:tkormann@ilog.fr]
Sent: maandag 16 juli 2001 8:57
To: Batik Users; Paul Hermans
Subject: Re: request : optimising size of generated PNG by the SVG

On Friday 13 July 2001 16:21, Paul Hermans wrote:
> Dear all,
> I'm generating programmatically SVG from an SGML file.
> This is fairly straigthforward except for determining
> the attributes width, heigth and viewport on the svg element.
> as in : <svg width="4in" height="3in" viewBox="0 0 40 30">
> So i leave those undefined.
> concrete : <svg>
> When I run the rasterizer to PNG, this works of course.
> But these PNG's are much too large.
> Result: when included in HTML the layout does not look as hoped for.
> Would it be possible that the rasterizer would automatically generate an
> optimised image size when the attributes width and height are not
> available.

Batik can not now what's the appropriate size as Peter mentions. This is due

to the use of percentages for example. If a rectangle has a width equals to 
100% - what does it mean ?

You can let your outermost svg element with no width and height. By default 
it means 100%, 100% and it's up to the user agent to choose the size. The 
JSVGCanvas chooses the size of the component (depending on the layout
and the size of your application). The transcoder has 400,400 (which is 
totally arbitrary) but you can set the default size using a transcoding

Hope this helps,

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

View raw message