Menu

Bitmaps

Anonymous

Introduction

This wiki covers the creating and usage of bitmaps. I currently run windows on the machine I use for development so these directions are for windows only until someone can provide better directions/directions for linux/macs.

Creating a bitmap

  1. Get Image2Code a handy little program that will do most of the work for you.
  2. Now create a bitmap that is a 1bit grayscale bmp. (I have literally no image editing experience so you are on your own here I have just been using paint.)
  3. Launch Image 2 Code.
  4. Select Browse and choose the bitmap you have created.
  5. hoose the third option form the left the one that says MSB LSB the default selections for this mode are correct.
  6. Make sure Invert Image is checked at the bottom and C Array Writer is chosen.
  7. Click Convert and notepad will open up with your bitmap definitions.
  8. Now create a .h This one is called TVOlogo.h:

    # include <avr/pgmspace.h>
    # ifndef TVOLOGO_H
    # define TVOLOGO_H
    
    extern const unsigned char TVOlogo[];
    #endif
    
  9. Next create a .cpp file, you will copy the image data into this removing the { from the beginning of each line and the } from the end of each. Also you must add the width then the height of the image to the beginning of the file like so TVOlogo.cpp:

    #include "TVOlogo.h"
    PROGMEM const unsigned char TVOlogo[] = {
    96,32,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,
    0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,
    0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38,
    0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42,
    0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42,
    0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42,
    0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42,
    0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42,
    0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42,
    0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42,
    0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42,
    0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42,
    0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42,
    0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42,
    0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42,
    0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42,
    0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42,
    0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42,
    0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42,
    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2,
    0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
    0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,
    0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,
    0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    };
    
  10. Save these in your sketch's directory

  11. Use your bitmap like so: TV.bitmap(x,y,Bitmap);

Related

Wiki: Bitmap
Wiki: DataCreation
Wiki: TableOfContents

Discussion

  • Anonymous

    Anonymous - 2012-10-08

    Originally posted by: gabe240s...@gmail.com

    Oh thanks, i looked at the cp and im like JAW DROPPED, then i saw this

     
  • Anonymous

    Anonymous - 2013-06-24

    Originally posted by: thousand...@gmail.com

    couldn't get it to work 1st attempt: Image began to load shifted strangely, but "crashed" TVout and left the led on pin 13 flashing.

    2nd attempt: Image began to lead and ended up displaying scrambled junk.

    maybe one to many pixels?

    this guide refers to Image2Code?'s default options, which may change at a later date, although probably not.

     
  • Anonymous

    Anonymous - 2013-06-24

    Originally posted by: thousand...@gmail.com

    SUCCESS: following up my previous post.

    I forgot the first two numbers in the image array: the x and y distentions of the image. in "TVOlogo.cpp" the horizontal res is 96 and the vertical is 32.

    due to lack of documentation on the function TV.bitmap, this is what i have learned from trial and error:

    TV.bitmap(x,y,Bitmap); add you resolution to the first two values in your array or TV.bitmap(x,y,Bitmap,i,width,height); and your resolution here instead. I thought "i" was inversion but with 0 or 1 but nothing happens.

    I found that I needed inversion unchecked in Image2Code? :\

    i wana make a video geam nou! thanks TVout!

     

    Last edit: Anonymous 2017-09-28
  • Anonymous

    Anonymous - 2013-10-09

    Originally posted by: jepser...@gmail.com

    I'm getting this error:

    project_com3_final.cpp.o: In function setup': C:\Program Files (x86)\Arduino/project_com3_final.ino:22: undefined reference toTVOlogo' C:\Program Files (x86)\Arduino/project_com3_final.ino:22: undefined reference to `TVOlogo'

    Any ideas?

     
  • Anonymous

    Anonymous - 2014-08-19

    Originally posted by: bombapi...@gmail.com

    Hey! You can use PixelFactory? for same puporse.

     

    Last edit: Anonymous 2017-06-02

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.