Custom Font + PNG Image with Python Thermal Printer

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ethanm
 
Posts: 1
Joined: Sun Sep 01, 2013 9:38 pm

Custom Font + PNG Image with Python Thermal Printer

Post by ethanm »

I am looking to use a custom font (.tff file extension) to print with my thermal printer from the Adafruit shop (https://www.adafruit.com/product/600). How can I add this to my project? Also, how can I print a basic .png image?

Thanks in advance!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Custom Font + PNG Image with Python Thermal Printer

Post by adafruit_support_mike »

The printer isn't anything near that sophisticated.

You'd need a rasterizer that could compose the output you want using the fonts and PNGs then convert it to a stream of "black dot here, white dot here" data that the printer can understand.

The easiest way to do it would probably be use something like ImageMagick to compose the images and then export the output as a BMP.

User avatar
Upol
 
Posts: 6
Joined: Thu Apr 09, 2015 11:16 am

Re: Custom Font + PNG Image with Python Thermal Printer

Post by Upol »

Hello, I also having image printing issue.

I want to do graph image printing using thermal printer. As printer uses monochrome image printing I converted png image to bmp using zam-zam online vonverter. And used LCD Assitant software to get data values of the image. After this I run the python code to print the image as printertest.py did (btw I am using adafruit/Python-Thermal-Printer library)

from PIL import Image
from Adafruit_Thermal import *
printer = Adafruit_Thermal("/dev/ttyO4", 19200, timeout=5)
import rot as result
printer.printBitmap(result.width, result.height, result.data)
printer.println("Adafruit!")
printer.feed(1)
But nothing got printed, excepts Adafruit line.

When I did print of png image converted to monochrome image by using PIL library, at least I was able to see unclear graph. How can I get clear graph prints from adafruit thermal printer?
I really appreciate all your suggestions.
Regards,
Upol

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”