0

May 5, 2016 AT 12:35 pm

The Floyd-Steinberg Dithering Algorithm for Thermal Paper Printing #Java

If you’ve ever converted an image to GIF and restricted its color table to 256, you effectively employed the Floyd–Steinberg dithering algorithm. For thermal printers – where the background is typically white and black is probably your only ink color – the challenges are different but you can still achieve remarkable results. Thankfully Pierre Muth walks through the process, all stemming from his Free Beer Selfie project.

To print pictures on thermal paper with reasonably good rendering, they should be converted according the printer limitations. It’s quite simple, it can be printed only black pixels (and whites as the paper is usually white).

img_3696

As receipt thermal printer use paper roll, there is virtually no image length limit. If we want to convert on the fly the image and strait print it, we cannot rely on a fixe full image sized buffer. That’s why I experimenting conversion algorithm based on Floyd-Steinberg, but with only a small rotating buffer. The size of this ‘line’ buffer could be as small as a line size plus one.

Other than the code itself, I try to explain the principle with this Gif :

dither

Read more.


Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!


Maker Business — “ORANGE PI: MEETING WITH STEVEN ZHAO IN SHENZHEN”

Wearables — Design with IFTTT

Electronics — Keep track of those rails!

Biohacking — Why Our Eyes Cannot Look at a Solar Eclipse

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



No Comments

No comments yet.

Sorry, the comment form is closed at this time.