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 Per Jessen Schmidt <pj...@yawah.com> on 2007/04/23 09:18:03 UTC

Problems with Rendering of small images

Hello,

I have a problem with antialiasing when rendering to small images,  
particular on the Mac. When creating small thumbnail sized images  
with thin lines, the image can be very "dim", on the Mac they almost  
disappear. The problem is that I cannot override the Render default  
rendering hints. The image transcoder's transcode method create the  
render with the default rendering hints, and I cannot find a method  
to change this without changing the source code.

I have my own transcoder that override the createImage and writeImage  
methods. The reason for this is that we render SVG on the server side  
sometimes on top of an existing image, sometimes on a clean image.

My questions are: does anyone have the same problem? And do anyone  
have a solution where you can override the default rendering hints on  
the render, when calling the transcode method, without changing the  
Batik code?

I have attached an example. A small SVG file rendered in 110 x 60  
pixel, on a PC and on a Mac with the default hints, and one rendered  
on the Mac where I have changed the Batik code to not use the anti  
aliasing rendering hint.

PS. Yes there are three images the one Mac one look empty, but crank  
up the contrast in Photoshop an there are image information :-)

Best Regards,
Per Jessen Schmidt

YaWah.com ApS
Egå Havvej 25 c
DK-8250 Egå
Phone:		+45 7026 2515
Phone direct:	+45 4029 9901
Fax:			+45 8749 0515
This email message is for the sole use of the intended recipient(s)  
and may contain confidential and privileged information. Any  
unauthorized review, use, disclosure or distribution is prohibited.  
If you are not the intended recipient, please contact the sender by  
reply email and destroy all copies of the original message.







Re: Problems with Rendering of small images

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

Per Jessen Schmidt <pj...@yawah.com> wrote on 04/25/2007 03:11:15 AM:

> We cannot control how the SVGs that we show are created.

   But you can control the document that is sent to the transcoder.
Once you have read the document and built the DOM you can add the
attribute before giving it to the transcoder.

> I think it would be a good idea to have a way to control the 
> rendering hits for the transcoder. We might implement a 
> adaptive algorithm for switching antialiasing on and off, depending 
> on the size and content of the image.

   Sure, but the adaptive algorithm would likely need to look
at the DOM to make such determinations.

> So if you re-factored the imagetranscoder interface so that the 
> render is created by calling at method that I can override, I can 
> just call super and add the rendering hints to the render at that 
> point to the returned renderer. E.g. move this

    Yes, this is what I was proposing.  I'll commit it shortly.

> 
>         // paint the SVG document using the bridge package
>         // create the appropriate renderer
>         ImageRendererFactory rendFactory = new 
ConcreteImageRendererFactory();
>         // ImageRenderer renderer = 
rendFactory.createDynamicImageRenderer();
>         ImageRenderer renderer = 
rendFactory.createStaticImageRenderer();
> 
> to a method called something like createRenderer like this
> 
> public ImageRenderer createRenderer()
> {
>         // create the appropriate renderer
>         ImageRendererFactory rendFactory = new 
ConcreteImageRendererFactory();
>         // ImageRenderer renderer = 
rendFactory.createDynamicImageRenderer();
>         ImageRenderer renderer = 
rendFactory.createStaticImageRenderer();
> 
> return renderer;
> }
> 
>  That would work perfectly for us.
> 
> Best Regards,
> Per Jessen Schmidt             
> 
> YaWah.com ApS
> Egå Havvej 25 c 
> DK-8250 Egå            
> Phone: +45 7026 2515  
> Phone direct: +45 4029 9901  
> Fax: +45 8749 0515  
> This email message is for the sole use of the intended recipient(s) 
> and may contain confidential and privileged information. Any 
> unauthorized review, use, disclosure or distribution is prohibited. 
> If you are not the intended recipient, please contact the sender by 
> reply email and destroy all copies of the original message.
> 
> On 23/04/2007, at 15.36, thomas.deweese@kodak.com wrote:
> 
> Hi Per,
> 
> Per Jessen Schmidt <pj...@yawah.com> wrote on 04/23/2007 03:18:03 AM:
> 
> I have a problem with antialiasing when rendering to small images, 
> particular on the Mac. When creating small thumbnail sized images 
> with thin lines, the image can be very "dim", on the Mac they 
> almost disappear. The problem is that I cannot override the Render 
> default rendering hints. The image transcoder's transcode method 
> create the render with the default rendering hints, and I cannot 
> find a method to change this without changing the source code.
> 
>    Why don't you add 'shape-rendering="crispEdges"' to the root
> of the document being rendered?
> 
> I have my own transcoder that override the createImage and 
> writeImage methods. The reason for this is that we render SVG on the
> server side sometimes on top of an existing image, sometimes on a clean 
> image.
> 
> My questions are: does anyone have the same problem? And do anyone 
> have a solution where you can override the default rendering hints 
> on the render, when calling the transcode method, without changing 
> the Batik code?
> 
>    If it helps I could add a 'createRenderer' method that you could
> override.
> 
> I have attached an example. A small SVG file rendered in 110 x 60 
> pixel, on a PC and on a Mac with the default hints, and one rendered
> on the Mac where I have changed the Batik code to not use the anti 
> aliasing rendering hint.
> 
> PS. Yes there are three images the one Mac one look empty, but crank
> up the contrast in Photoshop an there are image information :-)
> 
> Best Regards,
> Per Jessen Schmidt             
> 
> YaWah.com ApS
> Egå Havvej 25 c 
> DK-8250 Egå            
> Phone: +45 7026 2515  
> Phone direct: +45 4029 9901  
> Fax: +45 8749 0515  
> This email message is for the sole use of the intended recipient(s) 
> and may contain confidential and privileged information. Any 
> unauthorized review, use, disclosure or distribution is prohibited. 
> If you are not the intended recipient, please contact the sender by 
> reply email and destroy all copies of the original message.
> 
> [image removed] 
> [image removed] 
> [image removed] 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

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


Re: Problems with Rendering of small images

Posted by Per Jessen Schmidt <pj...@yawah.com>.
Hi Thomas,

We cannot control how the SVGs that we show are created.

I think it would be a good idea to have a way to control the  
rendering hits for the transcoder. We might implement a adaptive  
algorithm for switching antialiasing on and off, depending on the  
size and content of the image.

So if you re-factored the imagetranscoder interface so that the  
render is created by calling at method that I can override, I can  
just call super and add the rendering hints to the render at that  
point to the returned renderer. E.g. move this

         // paint the SVG document using the bridge package
         // create the appropriate renderer
         ImageRendererFactory rendFactory = new  
ConcreteImageRendererFactory();
         // ImageRenderer renderer =  
rendFactory.createDynamicImageRenderer();
         ImageRenderer renderer =  
rendFactory.createStaticImageRenderer();

to a method called something like createRenderer like this

	public ImageRenderer createRenderer()
	{
	        // create the appropriate renderer
         	ImageRendererFactory rendFactory = new  
ConcreteImageRendererFactory();
         	// ImageRenderer renderer =  
rendFactory.createDynamicImageRenderer();
         	ImageRenderer renderer =  
rendFactory.createStaticImageRenderer();

		return renderer;
	}

  That would work perfectly for us.

Best Regards,
Per Jessen Schmidt

YaWah.com ApS
Egå Havvej 25 c
DK-8250 Egå
Phone:		+45 7026 2515
Phone direct:	+45 4029 9901
Fax:			+45 8749 0515
This email message is for the sole use of the intended recipient(s)  
and may contain confidential and privileged information. Any  
unauthorized review, use, disclosure or distribution is prohibited.  
If you are not the intended recipient, please contact the sender by  
reply email and destroy all copies of the original message.





On 23/04/2007, at 15.36, thomas.deweese@kodak.com wrote:

> Hi Per,
>
> Per Jessen Schmidt <pj...@yawah.com> wrote on 04/23/2007 03:18:03 AM:
>
>> I have a problem with antialiasing when rendering to small images,
>> particular on the Mac. When creating small thumbnail sized images
>> with thin lines, the image can be very "dim", on the Mac they
>> almost disappear. The problem is that I cannot override the Render
>> default rendering hints. The image transcoder's transcode method
>> create the render with the default rendering hints, and I cannot
>> find a method to change this without changing the source code.
>
>    Why don't you add 'shape-rendering="crispEdges"' to the root
> of the document being rendered?
>
>> I have my own transcoder that override the createImage and
>> writeImage methods. The reason for this is that we render SVG on the
>> server side sometimes on top of an existing image, sometimes on a  
>> clean
> image.
>>
>> My questions are: does anyone have the same problem? And do anyone
>> have a solution where you can override the default rendering hints
>> on the render, when calling the transcode method, without changing
>> the Batik code?
>
>    If it helps I could add a 'createRenderer' method that you could
> override.
>
>> I have attached an example. A small SVG file rendered in 110 x 60
>> pixel, on a PC and on a Mac with the default hints, and one rendered
>> on the Mac where I have changed the Batik code to not use the anti
>> aliasing rendering hint.
>>
>> PS. Yes there are three images the one Mac one look empty, but crank
>> up the contrast in Photoshop an there are image information :-)
>>
>> Best Regards,
>> Per Jessen Schmidt
>>
>> YaWah.com ApS
>> Egå Havvej 25 c
>> DK-8250 Egå
>> Phone: +45 7026 2515
>> Phone direct: +45 4029 9901
>> Fax: +45 8749 0515
>> This email message is for the sole use of the intended recipient(s)
>> and may contain confidential and privileged information. Any
>> unauthorized review, use, disclosure or distribution is prohibited.
>> If you are not the intended recipient, please contact the sender by
>> reply email and destroy all copies of the original message.
>>
>> [image removed]
>> [image removed]
>> [image removed]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users- 
> help@xmlgraphics.apache.org
>


Re: Problems with Rendering of small images

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

Per Jessen Schmidt <pj...@yawah.com> wrote on 04/23/2007 03:18:03 AM:

> I have a problem with antialiasing when rendering to small images, 
> particular on the Mac. When creating small thumbnail sized images 
> with thin lines, the image can be very "dim", on the Mac they 
> almost disappear. The problem is that I cannot override the Render 
> default rendering hints. The image transcoder's transcode method 
> create the render with the default rendering hints, and I cannot 
> find a method to change this without changing the source code.

   Why don't you add 'shape-rendering="crispEdges"' to the root
of the document being rendered?

> I have my own transcoder that override the createImage and 
> writeImage methods. The reason for this is that we render SVG on the
> server side sometimes on top of an existing image, sometimes on a clean 
image.
> 
> My questions are: does anyone have the same problem? And do anyone 
> have a solution where you can override the default rendering hints 
> on the render, when calling the transcode method, without changing 
> the Batik code?

   If it helps I could add a 'createRenderer' method that you could
override.

> I have attached an example. A small SVG file rendered in 110 x 60 
> pixel, on a PC and on a Mac with the default hints, and one rendered
> on the Mac where I have changed the Batik code to not use the anti 
> aliasing rendering hint.
> 
> PS. Yes there are three images the one Mac one look empty, but crank
> up the contrast in Photoshop an there are image information :-)
> 
> Best Regards,
> Per Jessen Schmidt             
> 
> YaWah.com ApS
> Egå Havvej 25 c 
> DK-8250 Egå            
> Phone: +45 7026 2515  
> Phone direct: +45 4029 9901  
> Fax: +45 8749 0515  
> This email message is for the sole use of the intended recipient(s) 
> and may contain confidential and privileged information. Any 
> unauthorized review, use, disclosure or distribution is prohibited. 
> If you are not the intended recipient, please contact the sender by 
> reply email and destroy all copies of the original message.
> 
> [image removed] 
> [image removed] 
> [image removed] 

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