Introduction: My Portable Photo Printer
This is an entry in the
Remote Control Contest 2017
Thermal printer is a common device for printing receipts. And it's popular for DIYers too. You can get this from the link below.
Recently I've found an interesting thermal printer at aliexpress.com. It's faster, portable and controllable over bluetooth. (also supports WiFi and IR connection but in expensive model). You can get this about $35.
I thought that if there's a proper app for this printer, it can be a cheap and portable photo printer. So I made a mobile app for this: "Printer Lab".
Step 1: Get a Thermal Printer
I got a thermal printer from aliexpress. Here are specifications for the printer.
- Protocol : ESC/POS command
- Paper size : 58mm
- Paper roll diameter : < 4cm
- Supports bluetooth 4.0, 3.0
- Pixel density : 384 dot/line
- Battery : 7.4V, 1500mAh
No need for soldering or wiring. All I need is to buy a printer and paper rolls. But making a mobile app for this is much more complex.
Step 2: Image Printing
A manufacturer of the thermal printer supports an Android/iOS app and SDK. But very simple functions, like printing image in low quality, simple text and QR/Barcode printing, are available. I have to make a whole new app. It's named "Printer Lab". (only supports Android v5.0 or above)
At first, I made an image printing function based on a library which provided by a printer manufacturer. Next, I selected a picture of my son and printed it!
(See picture 1. Print with default settings)
As you see, very poor quality.
Thermal printers do a simple work: set a pixel as white(blank space) or black. So the printer image library converts color image to grayscale image, and it gets an average grayscale value of a whole image and sets a pixel as white if grayscale value of the pixel is less than the average. A pixel becomes black if its grayscale value is bigger than the average. The result is an 1-bit bitmap which has only 2 pixel status, black or white.
This result is not what I want. So I used an ordered dithering. This method converts 2x2 pixels to 5 types of patterns according to an average grayscale of 4 pixels.
__ #_ #_ ## ##
__ __ _# _# ##
(See picture 2. ordered dithering)
It's much better than before instead image is slightly blurry, which still is not satisfying. Error diffusion dithering solves this problem. This algorithm improve image quality much more.
(See picture 3. Error diffusion)
Error diffusion is complex to describe here. You can learn details from the link below:
Now I can print images from albums or camera at low cost. But it's not an end.
Step 3: Text Printing (2 Byte Characters)
Major work of thermal printer is to print receipts with a few fonts. I tested text printing and most of thermal printers do this job well though very few font styles are available.
But there's one big problem. Thermal printers, specifically the one that I bought on Chinese online stores, support only English, Chinese and a few kinds of characters. Many other languages, in my case Korean, are not available. So I decided to print every characters as an image like picture though it's English or Chinese.
In this way I can use any kind of characters, but print quality is slightly poorer than embedded font. Anyway, character printing is ready. It's time to develop various functions based on this.
Step 4: Extensions
# Simple text printing
It prints out texts typed by yourself or pasted from clipboard. You can send texts from other apps to Printer Lab.
# QR code / Barcode
It converts text to QR-code/barcode and print it out.
# RSS feed
You are able to register RSS address and print feeds. For convenience, I made RSS browser which browse RSS links on web. By clicking button at right-bottom area you can easily register RSS address. After this step, Printer Lab gathers the title of feeds and prints them out.
- Main contents are excluded from printing because they are too big to print.
- Feeds gathered from RSS are registered in timeline. You can check this in timeline tab.
Gets daily events from google calendar and print them out. You have to click schedule button to connect it with your google account. After this step, Printer Lab gathers events automatically.
Prints vCard selected from contacts or shared from external app.
# Timeline tab
Timeline tab gathers feeds from RSS and google calendar. You can print it all at once. Printed feeds are dimmed and excluded at next print.
- Auto connect : Automatically connects to your printer at start-up. To use this, you must register 4-digit PIN code of printer.
- Auto print : Automatically print feeds in timeline tab at time interval you selected.
- Supports 80mm printer : 80mm printer has wide width, shows more characters and pixels at a line. To use this, 80mm printer must support 576 dots per line.
Step 5: Enjoy Printing!!
Bluetooth thermal printer is handy enough to carry anywhere and cheap enough to print as much as you wish. Get a printer and install Printer Lab at Google Play Store. And Enjoy insta-printing!!
Install PrinterLab at: https://play.google.com/store/apps/details?id=com...
Stay tuned for more updates!
# Useful links
Printer Lab download page (Android v5.0 or over)
thanks to : Chang-Han Jeon
QnA : https://play.google.com/store/apps/details?id=com...
List of 58mm thermal Printer https://play.google.com/store/apps/details?id=com...
How-To document of ESC/POS Printing in Android https://play.google.com/store/apps/details?id=com...
Error diffusion algorithm https://play.google.com/store/apps/details?id=com...
We have a be nice policy.
Please be positive and constructive.