Converting a simple image pixels??

Status
Not open for further replies.

combatevolved

New Member
Hi everyone,

I'm finishing up a project for a class and I wanted to finish off the presentation strong by displaying a big "?" (question mark) on my questions slide.

I'm using a 128 x 64 pixel LCD. If I could find a way to just map a .bmp of the question mark that would work perfect, I could just feed the [X, Y] coordinates in. May be inefficient, but it doesn't matter.

Does anyone have any experience doing this? I tried to find some sort of applet on the internet, but mostly java programming stuff. Oh, and I can't install stuff on this computer, I'm in a lab on campus.

Thanks ahead for any advice!

Josh
 
Just draw out what you want on 128x64 squares of graph paper. Then figure out a row at a time, turning it into bytes. 1 for part-of-the-question-mark, and 0 for blank screen. Just do a nybble at a time - think in hex. That makes it super easy. Then write some code to display those bytes and you're in business. Later you can use the same code to display any other full screen stuff you want to do.

If you do it a lot you'd want to build a PC program to automate all the figuring, but for a one-off just do it on graph paper.
 
Last edited:
Just use MATLAB if it's an option.

save the image in your work directory and use these commands:

A = imread('filename','filetype');
B = im2bw(A);

B will be your logical array.

Hope this helps! If you don't have access to MATLAB just send me the file and I'll send you the matrix.
 
A while ago I wrote this little utility to convert a bitmap to source code. Just navigate to the image file and double click it to get the source in the text box.

I can't upload the file at the moment. Possibly something to do with the new server. If you still need it I can post it later.

Mike.
 
hey its actually not that hard but just complicated a little.

Look at:
BMP (Windows) Header Format

you would have to open the image and re-arrange the values to line up the way you want. Im trying to learn for my sd project.

The way a BMP is organized is from LEFT ---to---> RIGHT Starting from BOTTOM ---to---> TOP

(info i know using 1 bit bmps)
so the first pixel data is @ offset X (x = what ever is in offset 10 (0x0A))
which is usually 0x3E

Once there you have to calculate how many bytes to the end and get data from the end and place it in a variable backwards since its normally from bottom to top and to display on a GLCD is best from top to bottom.

so you get how many pixels width from offset: 18(0x12) and you have to get that same with Q number of times where Q = image height in pixels offset:22 (0x16)

Since its windows and it sux you have to read them backwards also... to get WIDTH from 0x12. You have to read 0x12,0x11,0x10,0x0A but the from 0x0A-0x12 since its 4 bytes long. You have to do that with most the data you collect from the header.

Im still trying this but its not that easy. The IDEA seems easy but in practice... its a different story
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…