Thermal printer can't print my own images
Moderators: adafruit_support_bill, adafruit

Thermal printer can't print my own images

by atduskgreg on Wed Dec 14, 2011 4:50 pm

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
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 4:37 pm

Re: Thermal printer can't print my own images

by adafruit on Wed Dec 14, 2011 5:23 pm

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)?
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by atduskgreg on Wed Dec 14, 2011 5:46 pm

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
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 4:37 pm

Re: Thermal printer can't print my own images

by adafruit on Wed Dec 14, 2011 6:01 pm

look carefully at
https://gist.github.com/1478914
notice anything? :)
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by atduskgreg on Wed Dec 14, 2011 6:05 pm

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
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 4:37 pm

Re: Thermal printer can't print my own images

by adafruit on Wed Dec 14, 2011 10:59 pm

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)
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by atduskgreg on Thu Dec 15, 2011 5:02 pm

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!
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 4:37 pm

Re: Thermal printer can't print my own images

by adafruit on Thu Dec 15, 2011 5:57 pm

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
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by atduskgreg on Thu Dec 15, 2011 6:05 pm

Will do. I'm happy to dig into it myself too. Any ideas on what's up/where to start?
atduskgreg
 
Posts: 5
Joined: Wed Dec 14, 2011 4:37 pm

Re: Thermal printer can't print my own images

by adafruit on Thu Dec 15, 2011 9:41 pm

everything we know is in the documents posted, all code is in the library :)
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by peek on Sat Jan 14, 2012 6:38 am

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.wordpress.com/2011/10/09/sharing-links-physically/
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
peek
 
Posts: 21
Joined: Sat Jan 14, 2012 5:17 am

Re: Thermal printer can't print my own images

by adafruit on Sat Jan 14, 2012 12:12 pm

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 :)
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by peek on Sun Jan 15, 2012 8:09 am

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
peek
 
Posts: 21
Joined: Sat Jan 14, 2012 5:17 am

Re: Thermal printer can't print my own images

by adafruit on Sun Jan 15, 2012 12:17 pm

sure, open a ticket on github, thats ideal!
User avatar
adafruit
 
Posts: 11671
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Thermal printer can't print my own images

by micschk on Wed May 02, 2012 9:10 am

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.
micschk
 
Posts: 1
Joined: Wed May 02, 2012 9:02 am