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 Jonathan Dagresta <jd...@sdl.com> on 2012/10/23 06:56:14 UTC

Text in SVG image "blows up" when using -dpi 600 with rasterizer

One of our customers is complaining that when the use the rasterizer with
-dpi 600 to create 600 DPI jpeg files from SVG's, with some SVG files the
text of the image "blows up" to a very large size compared to the default 96
DPI result and compared to the other drawn parts of the image.

 

Attached are two SVG files, image1.svg which does not manifest this problem
and image2.svg which does show this problem.

 

Attached are four JPG files (commands below used to create them):

 

image1-096dpi.jpg (image1.svg converted to default 96 DPI JPEG)

image1-600dpi.jpg (image1.svg converted to 600 DPI JPEG - text in image does
not "blow up")

image2-096dpi.jpg (image2.svg converted to default 96 DPI JPEG)

image2-600dpi.jpg (image2.svg converted to 600 DPI JPEG - text in image
clearly does "blow up" to relatively large size)

 

BATIK 1.7

JAVA 1.5

 

java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99
-d image1-096dpi.jpg image1.svg

java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99 -dpi
600         -d image1-600dpi.jpg image1.svg

java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99
-d image2-096dpi.jpg image2.svg

java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99 -dpi
600         -d image2-600dpi.jpg image2.svg

 

What seems a significant difference in image2.svg is that most of the text
elements do not specify font-size, while all of the text elements in
image1.svg do specify the font-size value.

 

So the question we have: Is the 600 DPI result of image2.svg => JPEG where
the relative size of the text in the image "blows up" an expected result due
to the text elements not specifying the font-size value, or is this a bug in
the rasterizer?

 


Re: Text in SVG image "blows up" when using -dpi 600 with rasterizer

Posted by DeWeese Thomas <th...@gmail.com>.
Hi Jonathan,
    The reason the text is blowing up is because the default Font size in Batik is 9pt. So the font size is multiplied by the pixels/pt.  Also note that your top level SVG elements are defined in pixels rather than in real world units so the -dpi 600 doesn't actually make your output images any better.  You might consider either moving to real world units for the root SVG element or use the -width option to produce a larger output image rather than -dpi.

    You can fix the font-size issue by adding font-size="9".

    Thomas

On Oct 23, 2012, at 12:56 AM, Jonathan Dagresta <jd...@sdl.com> wrote:

> One of our customers is complaining that when the use the rasterizer with –dpi 600 to create 600 DPI jpeg files from SVG’s, with some SVG files the text of the image “blows up” to a very large size compared to the default 96 DPI result and compared to the other drawn parts of the image.
>  
> Attached are two SVG files, image1.svg which does not manifest this problem and image2.svg which does show this problem.
>  
> Attached are four JPG files (commands below used to create them):
>  
> image1-096dpi.jpg (image1.svg converted to default 96 DPI JPEG)
> image1-600dpi.jpg (image1.svg converted to 600 DPI JPEG – text in image does not “blow up”)
> image2-096dpi.jpg (image2.svg converted to default 96 DPI JPEG)
> image2-600dpi.jpg (image2.svg converted to 600 DPI JPEG – text in image clearly does “blow up” to relatively large size)
>  
> BATIK 1.7
> JAVA 1.5
>  
> java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99                      -d image1-096dpi.jpg image1.svg
> java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99 -dpi 600         -d image1-600dpi.jpg image1.svg
> java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99                      -d image2-096dpi.jpg image2.svg
> java -mx128m -jar batik-1.7/batik-rasterizer.jar -m image/jpeg -q .99 -dpi 600         -d image2-600dpi.jpg image2.svg
>  
> What seems a significant difference in image2.svg is that most of the text elements do not specify font-size, while all of the text elements in image1.svg do specify the font-size value.
>  
> So the question we have: Is the 600 DPI result of image2.svg => JPEG where the relative size of the text in the image “blows up” an expected result due to the text elements not specifying the font-size value, or is this a bug in the rasterizer?
>  
> <image2-600dpi.jpg><image2.svg><image1-096dpi.jpg><image1-600dpi.jpg><image1.svg><image2-096dpi.jpg>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org