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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
