[Image-SIG] Converting to zebra (ZPL) format
Peter Dempsey
yarglags at eircom.net
Fri Jun 17 06:22:09 CEST 2005
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
More information about the Image-SIG
mailing list