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 daveta lianto <da...@yahoo.com> on 2006/10/27 12:13:43 UTC

Conversion width and height

Hi. I have svg width and height in 100%. Why when I rasterized it, the image was crop to 400px width and height 400px?
  The width and height of svg is dynamic that’s why I can’t fixed it into certain pixels…
  Please help me to figure it out.. any suggestions???
   
  Thanks…

 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.

Re: Conversion width and height

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

daveta lianto <da...@yahoo.com> wrote on 10/27/2006 06:13:43 AM:

> I have svg width and height in 100%. 

   This indicates that the SVG should fill the container
into which it is placed.  It does not have any relation
to the contents of the SVG element.

> Why when I rasterized it, the image was crop to 
> 400px width and height 400px?

   Because you have not given any indication of what part of
the infinite canvas should be rendered.  The transcoder arbitrarily
picks 400x400 if the document doesn't request any size (i.e. 
width/height aren't set or are set to a percentage).

> The width and height of svg is dynamic that?s why I 
> can?t fixed it into certain pixels?

   How is Batik to know what part of the infinite canvas
it should render?

   Many people assume that it makes sense to render the
geometry bounds, however in my experience this is often
wrong (you need padding around graphics or you need to
clip the edges of the graphics).

> Please help me to figure it out.. any suggestions???

   I would suggest writing a small script that calculates
the desired bounds and sets them on the root SVG element.
Depending on how you create the SVG you could do this 
when it's constructed or you could do it in the rasterizer
with the '-onload' command line argument.

   The SVG DOM offers many functions to make this easy
(most notably 'getBBox').


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