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 Arian Hojat <ar...@gmail.com> on 2005/05/16 22:14:02 UTC

preserveAspectRatio, 'stretching' an image not working by percentage, and batik

Hello all, 
I view an svg in adobe svg viewer and it stretches the width and
height to be 100% of the svg document. but batik does not correctly
render it when i transcode (it will stretch the height so it fills up
the svg document. But it wont 'stretch' the width to match the svg doc
as well.)... Could it be adobe svg viewer is just leniant? or Batik is
not leniant with my code.

Anyone got ideas. I dont really override aspect ratio settings since
svg viewer interprets it fine.

Here are my svg code batik makes and images if anyone is more interested.

<svg contentScriptType="text/ecmascript" width="720"
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" height="360"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
version="1.0">

<image x="0" y="0" width="720"
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="8.jpg"
xlink:type="simple" xlink:actuate="onLoad" height="360"
preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>

<image x="0" y="0" width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="4.png"
xlink:type="simple" xlink:actuate="onLoad" opacity="0.7" height="100%"
preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>

</svg>


http://www.pages.drexel.edu/~ah49/images/8.jpg
http://www.pages.drexel.edu/~ah49/images/4.png

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


Re: preserveAspectRatio, 'stretching' an image not working by percentage, and batik

Posted by Thomas DeWeese <Th...@Kodak.com>.
Arian Hojat wrote:

> I view an svg in adobe svg viewer and it stretches the width and
> height to be 100% of the svg document. but batik does not correctly
> render it when i transcode (it will stretch the height so it fills up
> the svg document. But it wont 'stretch' the width to match the svg doc
> as well.)... Could it be adobe svg viewer is just leniant? or Batik is
> not leniant with my code.

    The mentioned behavior is a flat out bug in ASV.  They ignore
the value of preserveAspectRatio and always behave as if it were
'none'.  The behavior you describe is the correct behavior for
the value you have provided 'xMidyMid meet'.

> Anyone got ideas. I dont really override aspect ratio settings since
> svg viewer interprets it fine.

   No the 'svg viewer' interprets it wrong.  Give it the proper value
'none' and your document will render as you want in Batik, and any
other con formant SVG viewer/renderer you pass it to.

> Here are my svg code batik makes and images if anyone is more interested.
> 
> <svg contentScriptType="text/ecmascript" width="720"
> xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
> contentStyleType="text/css" height="360"
> preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
> version="1.0">
> 
> <image x="0" y="0" width="720"
> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="8.jpg"
> xlink:type="simple" xlink:actuate="onLoad" height="360"
> preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
> 
> <image x="0" y="0" width="100%"
> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="4.png"
> xlink:type="simple" xlink:actuate="onLoad" opacity="0.7" height="100%"
> preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
> 
> </svg>
> 
> 
> http://www.pages.drexel.edu/~ah49/images/8.jpg
> http://www.pages.drexel.edu/~ah49/images/4.png
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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