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 "Longson, Robert" <Ro...@logicacmg.com> on 2003/12/15 18:52:19 UTC
transcoding using viewBox to determine height/width
If you try to use the transcoder on a page that does not have a width or a
height set the transcoder produces the following message (batik 1.5):
Error building JPEG org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
Width (0) and height (0) cannot be <= 0
Would it be reasonable to change Batik such that if the width and height
were both 0, viewBox data would be used as the width and height i.e. you get
the width and height as the 3rd and 4th arguments of the svg viewBox
attribute.
Obviously if there was no viewBox either you would still get the above
error.
SVG viewers can display files with a viewBox and no width and height
settings so why shouldn't the transcoder be able to convert them?
Robert Longson
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Re: transcoding using viewBox to determine height/width
Posted by Thomas DeWeese <Th...@Kodak.com>.
Longson, Robert wrote:
>
> If you try to use the transcoder on a page that does not have a width or
> a height set the transcoder produces the following message (batik 1.5):
Actually in my testing having no width/height attributes transcodes
fine resulting in a default image size of 400x400 being used.
Command line:
% ./build.sh svgrasterizer -m image/jpeg ../test/anne.svg
SVG Tag:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 450 500">
I get almost the same error as you show if I set width/height to
zero. In this case I think it is very reasonable to give an error.
Same command line, SVG Tag:
SVG Tag:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="0" height="0"
viewBox="0 0 450 500">
Error:
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
Width (0) and height (0) must be > 0
at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:163)
> Error building JPEG org.apache.batik.transcoder.TranscoderException: null
> Enclosed Exception:
> Width (0) and height (0) cannot be <= 0
> Would it be reasonable to change Batik such that if the width and height
> were both 0, viewBox data would be used as the width and height i.e. you
> get the width and height as the 3rd and 4th arguments of the svg viewBox
> attribute.
I don't really like this approach as the whole point of viewbox is
to take a potentially _very_large_ or _very_small_ area of the canvas
and map it to width/height. I much prefer the behavior of using a
default known 'reasonable' w/h being used.
> Obviously if there was no viewBox either you would still get the above
> error.
>
> SVG viewers can display files with a viewBox and no width and height
> settings so why shouldn't the transcoder be able to convert them?
My testing shows that it is able to. Perhaps something is wrong in
in the way you are using the Transcoder?
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org