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 Robert Jenks <rj...@animefest.org> on 2012/09/21 17:00:58 UTC

Barcodes in SVG

I am currently using Batik as part of a workflow to print badges for a
convention.   I have a java desktop application which:

   1. polls a web server for badges to print
   2. retrieves the data (type, template name, person's name, id, etc...)
   3. loads an appropriate SVG template
   4. Uses ZXing to generate a code-128 barcode and an QR code
   5. Loads the appropriate picture for the badge
   6. converts the barcode and picture PNGs into data: urls
   7. find the appropriate elements in the svg dom and replaces the dummy
   images with the picture and barcode data: urls
   8. sets the batik transcoder output resolution
   9. rasterizes the svg to a png file
   10. sends the png to a photo printer

The problem I am having is that resulting badge png has artifacts in the
barcodes.  They're either antialiasing or scaling artifacts.  This makes
the barcode a little hard to scan with readers and slowed down our
registration system.  Does anyone have any suggestions on how I can keep
the barcode images as crisp black and white images inside the full color
badge?

Thanks,
Robert

Re: Barcodes in SVG

Posted by Robert Jenks <rj...@animefest.org>.
Thank you!  I will give that a try.
On Sep 22, 2012 6:28 AM, "DeWeese Thomas" <th...@gmail.com> wrote:

> Hi Robert,
> You should try adding style="image-rendering:optimizeSpeed" to the image
> elements (you can put it in the templates probably).  That should disable
> the anti-aliasing when resizing the barcodes.
>
> Thomas
>
> On Sep 21, 2012, at 11:00 AM, Robert Jenks <rj...@animefest.org> wrote:
>
> I am currently using Batik as part of a workflow to print badges for a
> convention.   I have a java desktop application which:
>
>    1. polls a web server for badges to print
>    2. retrieves the data (type, template name, person's name, id, etc...)
>    3. loads an appropriate SVG template
>    4. Uses ZXing to generate a code-128 barcode and an QR code
>    5. Loads the appropriate picture for the badge
>    6. converts the barcode and picture PNGs into data: urls
>    7. find the appropriate elements in the svg dom and replaces the dummy
>    images with the picture and barcode data: urls
>    8. sets the batik transcoder output resolution
>    9. rasterizes the svg to a png file
>    10. sends the png to a photo printer
>
> The problem I am having is that resulting badge png has artifacts in the
> barcodes.  They're either antialiasing or scaling artifacts.  This makes
> the barcode a little hard to scan with readers and slowed down our
> registration system.  Does anyone have any suggestions on how I can keep
> the barcode images as crisp black and white images inside the full color
> badge?
>
> Thanks,
> Robert
>
>
>

Re: Barcodes in SVG

Posted by DeWeese Thomas <th...@gmail.com>.
Hi Robert,
	You should try adding style="image-rendering:optimizeSpeed" to the image elements (you can put it in the templates probably).  That should disable the anti-aliasing when resizing the barcodes.

	Thomas

On Sep 21, 2012, at 11:00 AM, Robert Jenks <rj...@animefest.org> wrote:

> I am currently using Batik as part of a workflow to print badges for a convention.   I have a java desktop application which:
> polls a web server for badges to print
> retrieves the data (type, template name, person's name, id, etc...)
> loads an appropriate SVG template
> Uses ZXing to generate a code-128 barcode and an QR code
> Loads the appropriate picture for the badge
> converts the barcode and picture PNGs into data: urls
> find the appropriate elements in the svg dom and replaces the dummy images with the picture and barcode data: urls
> sets the batik transcoder output resolution
> rasterizes the svg to a png file
> sends the png to a photo printer
> The problem I am having is that resulting badge png has artifacts in the barcodes.  They're either antialiasing or scaling artifacts.  This makes the barcode a little hard to scan with readers and slowed down our registration system.  Does anyone have any suggestions on how I can keep the barcode images as crisp black and white images inside the full color badge?
> 
> Thanks,
> Robert