Hi Peter, despite Fredik's lengthy and carefull answer, I think that is not what you were asking for - his program is suitable to print images inpout inline inside a Python program as sequences of 0 and 1's.
But I think you were asking for a way to print a generic image read from a disk file. I can code that for you, if you wish so - just write me if no one else mailed yu a complete answer, and tell me more details about the images you want to print, maximum width of the printer, and stuff like that. I also did nt understand if the Hexadecimal data you send to the printer is actual ASCII - i.e. You send a real "F" character to get four dots "1111", or if you send a 15 decimal value standing for 0x0F ANd please, do confirm that you have PIL installed (call a interactive Python shell and type 'import Image' there if you are not sure). Regards, JS -><- On Friday 17 June 2005 01:22, Peter Dempsey wrote: > Hi folks, I'm a newbie to python so please be gentle. > > I want to convert an image to a format suitable for use in a Zebra > label printer. The data sent to the printer consists of a string of > hex characters. Each byte converts to a binary set of dots on the > label. > > FF becomes 11111111 > A5 becomes 10100101 > > So a string like this becomes a right-angle triangle... > > 18,3^m > F00000FF0000FFF000FFFF00FFFFF0FFFFFF > > The 18 says how many bytes in the image, 3 says how many bytes wide > the image is. So the string above becomes... > > F00000 -> 111100000000000000000000 > FF0000 -> 111111110000000000000000 > FFF000 -> 111111111111000000000000 > FFFF00 -> 111111111111111100000000 > FFFFF0 -> 111111111111111111110000 > FFFFFF -> 111111111111111111111111 > > I'm sure it's a simple task, I mean, the image is converted to a > hex representation of the raw image. > > I've had some success doing it the hard way with python, importing > a pcx image and going through it byte by byte but I'm sure there's > an easier way. > > Any suggestions would be super. > > I don't have my code here at home. I can post it tomorrow if it > helps. > > Thanks, > > Peter > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig