Thursday, August 22, 2013

How to generate smooth barcodes.

For every one pixel in width, the output of the movie barcode generator can be uneven from top to bottom. One way to fix this problem is to use a program called ImageMagick to compress the png file down to one pixel in height and then resizing it back up to original size. When compressing down to 1 pixel in height, ImageMagick finds the average of all the pixels in that column. And thus at the end of the process, each pixel in a given column is the average of all the pixels originally in that column, resulting in a smoother looking barcode.

Assuming your input is 1280x480, this is what the command line input would look like:

convert *.png -resize 1280x1! -resize 1280x480! *.png

You can see the difference below.

No comments:

Post a Comment