BMP2PCX Image File Conversion

Sep 7, 2007 at 10:11 AM
Edited Sep 8, 2007 at 10:39 AM
Hi All, hoping you'll consider a variant of the following as it will allow the output of 'bitmap' to zebra printers using the "EG" command by means of conversion from 'Bitmap' to 'PCX' preprocessing, many thanks to "Peter Morris" for this, I found it on his blog:

Im having real problems porting this from C# to VB.Net 2005 CAN ANYONE HELP!

I am not a C# developer, so any help of the 'For...loop' would be a big help.

// Extract Begins //
private string GetImagePixelsAsHex(Bitmap bmp, int xPosition, int yPosition)
StringBuilder result = new StringBuilder();

//Make sure the width is divisible by 8
int loopWidth = 8 - (bmp.Width % 8);
if (loopWidth == 8)
loopWidth = bmp.Width;
loopWidth += bmp.Width;

result.Append(string.Format("EG {0} {1} {2} {3} ", loopWidth / 8, bmp.Height, xPosition, yPosition));

for (int y = 0; y < bit =" 128;" currentvalue =" 0;" x =" 0;" color =" bmp.GetPixel(x," intensity =" 255" intensity =" 0;">= 128)
currentValue |= bit;
bit = bit >> 1;
if (bit == 0)
bit = 128;
currentValue = 0;
return result.ToString();
}// Extract Ends //
Sep 17, 2007 at 10:22 PM
There are a couple of free programs and some not free (paintshop pro) that I used to convert images to a PCX file format required by the printer. I haven't tried building this stuff in because I haven't been able to test it. I might if I get a chance though.
Sep 18, 2007 at 6:36 PM
Edited Sep 18, 2007 at 6:49 PM
Hi 'thekuna', I posted this on 'Experts Exchange' 125 Points:

I need this in VB.Net 2005 source code for a 'ISV User Group Meeting (Zebra & Symbol)', if I get any takers I will post the results here too, if you like.

I also use 'PaintShop Pro', but it does incorporate that well into my bespoke developing applications.

Re: Testing, if you want to compile a 'TestApp' I am sure I should be able to test it on any printer in the Zebra range for you if you would like and if I cant I can always ask Zebra. Let me know if I can help.