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 Hago Ziegler <h...@hzbb.de> on 2008/11/02 15:37:09 UTC

96dpi or 300dpi - no difference

Hi,

I want to rasterize a svg-file with 300 dpi. My command-line input looks  
like this:
java -jar batik-rasterizer.jar -dpi 300 -d M:/hinter M:/hint/*.svg

But the option -dpi 300 doesn't make any difference.
The resulting png is exactly the same when I put --dpi 100 or -dpi 96. The  
same file-size, no difference.

What am I doing wrong?

Regards,  Hago

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


Re: 96dpi or 300dpi - no difference

Posted by Hago Ziegler <h...@hzbb.de>.
Hi,

thank you for your understandable help, now everything is much clearer to  
me :-)

Hago

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


Re: 96dpi or 300dpi - no difference

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

"Hago Ziegler" <h...@hzbb.de> wrote on 11/02/2008 06:53:38 PM:

> >> The resulting png is exactly the same when I put --dpi 100 or -dpi 
96.
> 
> Inside the svg-file the size is defined in pixel values (744 x 700).

  Well DPI stands for 'Dots Per Inch' meaning 'Pixels Per Inch'.  Since 
you
give the output size of the document in pixels already there is no 
sensible
way to apply the dpi flag to your pixels to map them to pixel units (since 

they are already pixel units)

  If you had used width="744pt" height="700pt" then we would use -dpi to
map Pt (points or 1/72nd of an inch) to pixels.

> No viewBox.

   This is essentially always the wrong thing to do (see below). 

> Since I read that the default dpi-value of the batik rasterizer is 
96dpi, 
> I expected a png-image with about 2240 x 2100 px when I set the dpi to 
300.

   In the above case since the dpi flag is only used to map real world 
units to userspace (or 'px' units).  Even if you added 'pt' to your 
width/height specification the result would be to make the width and 
height
much larger, but since there is no view box it would render the original
content at the same size with a lot of blank space to the right and 
bottom.
The ViewBox establishes what part of the canvas should be mapped to the
actually rendered output region.

   If you had a viewBox then you could either use 'pt' on the width and
height to get the effect you want, or you could specify the width and 
height
you wanted.  Otherwise your content is 'locked' into rendering 1:1 with 
pixels
unless you somehow manually insert a transform in the rendering.

Re: 96dpi or 300dpi - no difference

Posted by Hago Ziegler <h...@hzbb.de>.
Helder Magalhães schrieb:

>> The resulting png is exactly the same when I put --dpi 100 or -dpi 96.

> It seems that you may be using percentage document
> dimensions (such as width/height set to "100%") and not specifying the
> canvas dimension to the rasterizer (-w/-h rasterizer options [3]). Is
> this the case? ;-)

Inside the svg-file the size is defined in pixel values (744 x 700). No  
viewBox.
Since I read that the default dpi-value of the batik rasterizer is 96dpi,  
I expected a png-image with about 2240 x 2100 px when I set the dpi to 300.

Hago

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


Re: 96dpi or 300dpi - no difference

Posted by Helder Magalhães <he...@gmail.com>.
> java -jar batik-rasterizer.jar -dpi 300 -d M:/hinter M:/hint/*.svg
>
> But the option -dpi 300 doesn't make any difference.
> The resulting png is exactly the same when I put --dpi 100 or -dpi 96. The
> same file-size, no difference.
>
> What am I doing wrong?

A quick search within the mailing lists [1] brought up a potentially
related thread [2]. It seems that you may be using percentage document
dimensions (such as width/height set to "100%") and not specifying the
canvas dimension to the rasterizer (-w/-h rasterizer options [3]). Is
this the case? ;-)

By the way, if that wasn't the case (and if further searching doesn't
help either), can you attach a reduced test case [4] which shows the
symptom? Thanks.



> Regards,  Hago

Hope this helps,

  Helder Magalhães



[1] http://xmlgraphics.apache.org/batik/mailing-lists.html
[2] http://www.nabble.com/Svg-to-png-rasterizer-resolution---output-blurry-to2306600.html#a2306600
[3] http://xmlgraphics.apache.org/batik/tools/rasterizer.html
[4] http://webkit.org/quality/reduction.html

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