Thermal printer can't print my own images

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 5:37 pm

Thermal printer can't print my own images

Post by atduskgreg »

Today my Mini Thermal Printer arrived! I'm very excited about it! I'm doing a project where I would like to print a series of my own images.

I got it hooked up to power and the Arduino. I ran the example sketch that came with the Thermal library and it successfully printed. I ran LCD Assistant and generated a .cpp file with the byte array. I formatted it the way described in the tutorial. Here's the file I generated:

https://gist.github.com/1478653

I created an altered version of the example sketch, included this .cpp file and updated the code in a corresponding manner:

https://gist.github.com/1478687

When I run this the printer seems to leave a blank area of the size indicated but does not actually print out my image. If I swap in the byte array that came with the example app it prints the adafruit logo no problem. I'm setting the settings in LCD assistant as follows:

Byte orientation: horizontal
width: 257
height: 384
Include size: (not checked)
Size endianness: Little
Pixels/byte: 8
tablename: computerdiagram

The source image I am using is here: http://itp.nyu.edu/~gab305/files/comput ... source.bmp

I am also working on a Processing sketch that could do this same conversion from any image file, but that has different problems (and will be more likely to work once I have a functional example output).

https://gist.github.com/1475033

Thanks,

Greg Borenstein
NYU ITP Research Resident
http://gregborenstein.com

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

hi, in the tutorial we suggest
The first step is to get the logo prepared. The printer can only do monochrome (1-bit) images, and the max width/height seems to be 384 pixels. We suggest starting with a small bitmap (100 pixels or less on a side) and then experimenting to get the size and look you want.
did you start with a small bitmap (100 pixels or less on a side)?

atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 5:37 pm

Re: Thermal printer can't print my own images

Post by atduskgreg »

Scaled my image down to 67x100 and still having the same problem.

Here's the image: http://itp.nyu.edu/~gab305/files/small_ ... iagram.bmp

And here's the .cpp file from LCD Assistant (with the normal modifications):

https://gist.github.com/1478914

And here's my current Arduino code:

https://gist.github.com/1478923

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

look carefully at
https://gist.github.com/1478914
notice anything? :)

atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 5:37 pm

Re: Thermal printer can't print my own images

Post by atduskgreg »

Well it's all zeros except for the last couple dozen bytes. Is that what you're referring to? I should still see something, no? Also, I don't know why it's coming out so blank, the image has lines in it... http://itp.nyu.edu/~gab305/files/small_ ... iagram.bmp

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

its freaking out because the image is in the wrong format :)
The first step is to get the logo prepared. The printer can only do monochrome (1-bit) images, and the max width/height seems to be 384 pixels. We suggest starting with a small bitmap (100 pixels or less on a side) and then experimenting to get the size and look you want.

Use a image-editing program to save your image as a 1-bit BMP - we use paint which is built into Windows
when this happens the conversion doesnt work and you get a blank picture (all 0x00)

atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 5:37 pm

Re: Thermal printer can't print my own images

Post by atduskgreg »

I don't really understand where it came from but I've made progress!

I went through and resized the bmps in Photoshop and resent them to LCD Assistant, brought the results into Arduino and it started to work!

However there seems to be some kind of disconnect between the size of the image going into LCD Assistant and the values in the Thermal library. When I tried to print it using printBitmap() I found that it chopped off the image if I sent the actual dimensions. I then performed a series of experimental printings where I gradually increased the dimensions I was telling Thermal and it gradually revealed more of the image (before suddenly ceasing to show it at all above a certain size). Here's a photo of the output images with the current printBitmap() size settings printed out below each image (the real size of the bitmap that generated this array is: 229x336):

http://www.flickr.com/photos/unavoidabl ... 6517824579

Any thoughts on what I can do to display these full images at their actual size or what I'm doing wrong that's preventing that from happening?

Thanks!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

please open an issue on the github repo, we'll check it out - however its unlikely we'll be able to do any more development till after the new year

atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 5:37 pm

Re: Thermal printer can't print my own images

Post by atduskgreg »

Will do. I'm happy to dig into it myself too. Any ideas on what's up/where to start?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

everything we know is in the documents posted, all code is in the library :)

peek
 
Posts: 23
Joined: Sat Jan 14, 2012 6:17 am

Re: Thermal printer can't print my own images

Post by peek »

Hi,

I too ran into problems printing images!
After "some" experiments i'm pretty sure, that the maximum width for printable images is 255 !
Also the image has to be exactly the size you state in the printBitmap function!

As others do print images larger than that, it should be possible.
I have especially been looking into this projects code
http://electronicfields.BANNED.com/2 ... hysically/
There's a printImage function in ThermalPrinter.cs and I'm trying to port it to the arduino Thermal lib.
But so far with no success, any help greatly appreciated, as I'm a newbie!
My guess is, that it uses a different command to the printer therefore a different image format/byte order might be necessary!
(But: This function only prints images with exactly 384 width in size!)

Cheers,
Peek

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

hi peek, thanks for the note, we like your project. If you used our code/printer can you give us a shout out in your blog post? we would appreciate a link :)

peek
 
Posts: 23
Joined: Sat Jan 14, 2012 6:17 am

Re: Thermal printer can't print my own images

Post by peek »

hi peek, thanks for the note, we like your project. If you used our code/printer can you give us a shout out in your blog post? we would appreciate a link
i think you misunderstood my last post.
the project i was referring too, is not my own project!

i was just looking into this projects code, because it succesfully prints images(in this example qr codes) with a width of 384 px!

and i would like to repeat my statement, that i could not print images larger than 255 px wide using the Thermal lib provided by adafruit/ladyada!

i should open a tickent!

cheers,
peek

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Thermal printer can't print my own images

Post by adafruit »

sure, open a ticket on github, thats ideal!

micschk
 
Posts: 1
Joined: Wed May 02, 2012 10:02 am

Re: Thermal printer can't print my own images

Post by micschk »

I have successfully printed images with various sizes, up to 384 wide using the adafruit library. Key seems to be to keep the width of the image at a multiple of 8 (eg. 32, 64px etc). Don't know why, since the included example images are not, but that's what made it work for me.

Some shameless promotion: If you have troubles using the LCD assistant, you can use my online image to Byte array tool; it'll accept grayscale & RGB images in png, jpg & gif format.

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

Return to “Other Products from Adafruit”