Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Bitmap to Byte Conversion

jpanhalt

Well-Known Member
Most Helpful Member
I created this bitmap for my tractor/pallet lift icon. Deflection of the tips from level will be shown in inches/cm.

View attachment 62311

The icon was created with Paint that came with Windows XP. Resolution was about 64 pixels/inch.

Is there a freeware that will convert the pixel image to 8-bit, vertically mapped bytes for a GLCD table? I can only read Assembly.

John
 
On this forum I have seen programs to help make pictures for graphics LCDs. or To make fonts for GLCDs. A search might turn one up.
 
@HouseOFwax,

I hadn't seen that; although, I do usually search PicList first. The interface is quite easy, but seems to do only the top half of my icon. I will see if that can be dealt with. I made a test figure:

View attachment 62316

The pertinent part of the generated file (subtracting white space) was: 0xF0, 0xF0, 0xF0 and 0xFF,0xFF,0xFF,0xFF,0xFF. In other words, reading vertically, three half-bytes and five full bytes filed.

Maybe it will work. I am still open to other possibilities.

Thanks, John
 
@nickelflipper,

Thanks. I tried it and it seems to work. For the test image, it gave 0xE's instead of 0xF's for the first three bytes, but the rest was fine. For the actual icon, it seemed to do the whole thing. It also allows one to define bit order (big endian vs. little endian) and output format. It had more of a Windows rather than DOS feel to it.

Most important, I learned what to search on. I just haven't caught on "2" using terms like bmp2asm for searching. There were lots of relevant hits, when I searched on that.

Regards, John
 
@nickelflipper,

Thanks. I tried it and it seems to work. For the test image, it gave 0xE's instead of 0xF's for the first three bytes, but the rest was fine. For the actual icon, it seemed to do the whole thing. It also allows one to define bit order (big endian vs. little endian) and output format. It had more of a Windows rather than DOS feel to it.

Most important, I learned what to search on. I just haven't caught on "2" using terms like bmp2asm for searching. There were lots of relevant hits, when I searched on that.

Regards, John
From a feeble memory, a header file could be included in images which tells what type of encoding is involved. Sound like that could be it??
 
Thanks for the help. I think I have a pretty good start on it. It is not that one can't easily code these things by hand -- I did the icon pretty much pixel by pixel. But it is boring as heck.

As it stands now, the display will include the tractor and loader arms as a fixed character. The pallet forks will have three positions, up, down, and neutral. There will be a large character field, so it can be read easily, with the deviation in inches. On the far right, I will probably include a bar graph showing ambient temperature. That is basically so that if there are temperature-related errors, the operator can make a slight correction.

John
 
Howdy, this more of a "mix your own" recommendation. When presented with similar translation issues, I've found a spreadsheet with hex<->decimal and ASCII conversions allowed me to massage the answer. This Does take its' time, but you get better with both 'sheet manipulations And data/image conversions each time.

'Mem to use the "existence" and logical functions, as well as math stuff. It's really time to paint in broad strokes.

I've used it for mapping 7 segment LED (easy), LCD text (tougher), and hex to custom display (saved me Many times). Makes me want to light a candle for the original author of VisiCalc... <<<)))
 
Do you have a clean black and white image of your logo? I wrote a converter many years ago but it produces a raster version. However, I can easily make it spit out the data you require and I'm happy to post a version here for anyone to use.

Mike.
 
Actually, it was easier than I thought,

Your logo,
Code:
86,7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xBC,0xFE,0xFF,0xFF,0xFE,0xBE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x50,0x80,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xEF,0xCF,0x8F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x70,0x78,0x3C,0x1E,0x0F,0x07,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x1F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xF0,0xF8,0xFC,0xFE,0xFE,0x3F,0x1F,0x1F,0x1F,0x1F,0x1F,0x3F,0xFE,0xFE,0xFD,0xFB,0xF7,0x0F,0x1F,0x3F,0x7F,0xFE,0xFD,0xFB,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x04,0x03,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x3F,0x7F,0xFF,0xFF,0xFF,0xF8,0xF0,0xF0,0xE0,0xF0,0xF0,0xF8,0xFF,0xFF,0xFF,0x7F,0x1F,0x03,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0xF8,0xFE,0xFE,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
The first 2 values are width, height.

Same logo shifted into the top corner,
Code:
78,5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x7B,0xFF,0xFF,0xFF,0xFF,0xFB,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0x7C,0x3E,0x3E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x05,0x38,0xC0
0x00,0x00,0x80,0xC0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF1,0xF3,0xE7,0xEF,0xDF,0xBF,0x7F,0xFE,0xFC,0xF8,0xF0,0xE0,0xD0,0xB0,0x70,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x08,0x0E,0x07,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x80,0x80,0x40,0x30,0x0F
0x78,0xFF,0xFF,0xFF,0xFF,0xFF,0x83,0x01,0x01,0x01,0x01,0x01,0x83,0xFF,0xFF,0xFF,0xFF,0xFF,0x30,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x00,0x00,0x81,0xE3,0xE7,0xFF,0xFF,0xF0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00
0x00,0x03,0x07,0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x3E,0x3F,0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x0F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

Mike.
 
Last edited:
Thanks for the help and suggestions.

The original bitmap icon was 249X167 pixels with lots of white space. There were really two problems. One was to re-size for my 128X64 screen. When I did the original in Paint, I could not find a way to set the canvas size. The other problem was to convert to hex. I was hoping there would be a program that would do both. The links others provided did not re-size.

Photoshop did a nice job of re-sizing but is not great for one-bit pixel editing, at least not in my hands. After the re-size and crop, I went back to Paint and fixed a few errant pixels from the re-sizing to give the bmp attached. It is 96X47. There is a line of white pixels at the top and room for me to add characters that will show inclination. The icon itself will be only about 576 bytes of hex, many of which will be obvious by inspection.

Using a paper and pencil method was always an option. Still, if I can impose on Pommie to do that conversion with the smaller file, it will save me considerable time and drudgery. BMP is not allowed here, so it is zipped.

Regards, John

Edit: Pommie's comment about size just dawned on me. He must have resized it too.


View attachment 62412
 
Last edited:
Just on my way out but here is the data,
Code:
85,6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x8F,0xDF,0xFF,0xFF,0xFF,0xDF,0x8F,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xF7,0xE7,0xC7,0x87,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0x70,0x38,0x3C,0x1F,0x0F,0x07,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30
0x00,0x80,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0xFC,0xFC,0xF8,0xF9,0xF3,0xE7,0x8F,0x1F,0x3F,0x7F,0xFE,0xFC,0xF8,0xF0,0xE6,0xCE,0x1E,0x3E,0x7E,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x0F,0x00,0x00,0x00,0xC0,0xE1,0xF3,0xF7,0xFF,0xFF,0xF0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x03,0x07,0x0F,0x1F,0x1F,0x3F,0x3F,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7F,0x3F,0x3F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x1F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x1F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
First two are width (pixels) and height (bytes).

Edit, my program automatically deletes white space from the right and left. You can easily add padding if necessary.

Mike.
 
Last edited:
Wow, thanks. I am also headed out right now to do some farm work. Spring has come very early, and I need to clean out some drainage culverts. It has been a very wet year for us, and these few dry days can't be wasted. I don't look forward to it, but my little excavator helps.

John
 

Latest threads

New Articles From Microcontroller Tips

Back
Top