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 Manuel Mall <ma...@apache.org> on 2006/01/14 05:04:59 UTC

How to rasterize a SVG but not preserving the aspect ratio?

I need to rasterize SVGs but need in some cases apply non-uniform 
scaling. The transformers I have seen and sample code I came across 
always uses uniform scaling, i.e. preserve the aspect ratio.

The context is that I am currently writing a new renderer for FOP for an 
output format that doesn't support SVG. Therefore I need to convert the 
SVG into a raster format and for SVGs included as external-graphics I 
need to be able to 'obey' the possibly non-uniform scaling specified on 
the external-graphics element in the XSL-FO document.

Is there an easy way to do this?

Thanks

Manuel

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


Re: How to rasterize a SVG but not preserving the aspect ratio?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Without verifying the validity of my statement but trusting my memory:
yes, FO wins and a transformation is applied outside the image to
squeeze the image as needed. And that's the way I think it should be.

On 14.01.2006 14:09:48 Manuel Mall wrote:
<snip/>
> >    This is an interesting case of 'who should win'.
> 
> Yes it is interesting - what do fop-dev's think about this? What does 
> the PDF SVG transcoder do in this case? I assume from FOP's perspective 
> XSL-FO should win? Same as for other images formats which we happily 
> distort if the FO tells us so?


Jeremias Maerki


Re: How to rasterize a SVG but not preserving the aspect ratio?

Posted by Manuel Mall <mm...@arcus.com.au>.
Thomas,

thank you, that clarifies the situation. I am moving the thread to 
fop-dev for further considerations.

On Sat, 14 Jan 2006 08:54 pm, thomas.deweese@kodak.com wrote:
> Hi Manuel,
>
> Manuel Mall <ma...@apache.org> wrote on 01/13/2006 11:04:59 PM:
> > I need to rasterize SVGs but need in some cases apply non-uniform
> > scaling. The transformers I have seen and sample code I came across
> > always uses uniform scaling, i.e. preserve the aspect ratio.
>
>    No the transformers respect the 'preserveAspectRatio' attribute
> on the root SVG element.  The default for this is "xMidYMid meet"
> if this is set to "none" then the Transcoders should stretched
> non-uniformly.
>
> > The context is that I am currently writing a new renderer for FOP
> > for an
> >
> > output format that doesn't support SVG. Therefore I need to convert
> > the SVG into a raster format and for SVGs included as
> > external-graphics I need to be able to 'obey' the possibly
> > non-uniform scaling specified on the external-graphics element in
> > the XSL-FO document.
>
>    This is an interesting case of 'who should win'.

Yes it is interesting - what do fop-dev's think about this? What does 
the PDF SVG transcoder do in this case? I assume from FOP's perspective 
XSL-FO should win? Same as for other images formats which we happily 
distort if the FO tells us so?

>
> > Is there an easy way to do this?
>
>    The simplest thing is to adjust the preserveAspectRatio
> attribute on the root of the SVG tree before passing it to
> the transcoder.
>

Manuel

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


Re: How to rasterize a SVG but not preserving the aspect ratio?

Posted by Manuel Mall <mm...@arcus.com.au>.
Thomas,

thank you, that clarifies the situation. I am moving the thread to 
fop-dev for further considerations.

On Sat, 14 Jan 2006 08:54 pm, thomas.deweese@kodak.com wrote:
> Hi Manuel,
>
> Manuel Mall <ma...@apache.org> wrote on 01/13/2006 11:04:59 PM:
> > I need to rasterize SVGs but need in some cases apply non-uniform
> > scaling. The transformers I have seen and sample code I came across
> > always uses uniform scaling, i.e. preserve the aspect ratio.
>
>    No the transformers respect the 'preserveAspectRatio' attribute
> on the root SVG element.  The default for this is "xMidYMid meet"
> if this is set to "none" then the Transcoders should stretched
> non-uniformly.
>
> > The context is that I am currently writing a new renderer for FOP
> > for an
> >
> > output format that doesn't support SVG. Therefore I need to convert
> > the SVG into a raster format and for SVGs included as
> > external-graphics I need to be able to 'obey' the possibly
> > non-uniform scaling specified on the external-graphics element in
> > the XSL-FO document.
>
>    This is an interesting case of 'who should win'.

Yes it is interesting - what do fop-dev's think about this? What does 
the PDF SVG transcoder do in this case? I assume from FOP's perspective 
XSL-FO should win? Same as for other images formats which we happily 
distort if the FO tells us so?

>
> > Is there an easy way to do this?
>
>    The simplest thing is to adjust the preserveAspectRatio
> attribute on the root of the SVG tree before passing it to
> the transcoder.
>

Manuel

Re: How to rasterize a SVG but not preserving the aspect ratio?

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

Manuel Mall <ma...@apache.org> wrote on 01/13/2006 11:04:59 PM:

> I need to rasterize SVGs but need in some cases apply non-uniform 
> scaling. The transformers I have seen and sample code I came across 
> always uses uniform scaling, i.e. preserve the aspect ratio.

   No the transformers respect the 'preserveAspectRatio' attribute
on the root SVG element.  The default for this is "xMidYMid meet"
if this is set to "none" then the Transcoders should stretched
non-uniformly.

> The context is that I am currently writing a new renderer for FOP for an 

> output format that doesn't support SVG. Therefore I need to convert the 
> SVG into a raster format and for SVGs included as external-graphics I 
> need to be able to 'obey' the possibly non-uniform scaling specified on 
> the external-graphics element in the XSL-FO document.

   This is an interesting case of 'who should win'.

> Is there an easy way to do this?

   The simplest thing is to adjust the preserveAspectRatio
attribute on the root of the SVG tree before passing it to
the transcoder.

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