Displaying Images On MbedConsole

So, I finally got MbedConsole to display a fairly awesome monochrome graphic. Surprisingly, I had a very hard time finding any decent converters from an image to a monochrome byte array in C.

What I ended up finding a tool that works decently enough. The image appears to require a bit of massaging to like to work with it though.

  • Make the image's width a multiple of 8
  • Turn the image into grayscale and then turn the contrast all the way up to convert it to monochrome
  • Don't use indexed colors. Use grayscale or RGB
  • Use a decent format like GIF or PNG

Also, it requires (in my opinion) a bit of massaging to print it to the screen. The bits in each byte are arranged backwards in my opinion. So, my print loop ends up looking like this:

int tmp=0;
for(int y=0;y<HEIGHT;y++)
    for(int x=0;x<WIDTH;x++)
        int byte=tmp/8;
        int bit=tmp%8;
        bit=bit-7; //bits are reversed! Those bastards!
        vga_plot(x,y, (graphic[byte]&(1<<bit))==0);

Also, don't try to compute tmp using X and Y. Just don't, I wasted 2 hours before I gave up and just made it increment for each loop.

I would show the image now, but it's a bit of a surprise :) Don't want to spoil it.

Also, I think I'm going to scrap the programming environment for right now. It's just taking too long and I want to release this thing already.

Anyway, more news later.

Posted: 9/30/2012 5:41:16 AM


Once upon a time I was messing around in Photoshop and found this obscure WBMP format. It turns out that it's a very simple monochrome image format originally designed for mobile phones. I bet it'd work well for you. https://en.wikipedia.org/wiki/WBMP
4/6/2013 6:42:16 AM

Posting comments is currently disabled(probably due to spam)