How to convert a file to a bitmap?

Hi all,

I'm trying to use the Adafruit GFX Library and the drawRGBBitmap function but I'm not sure how to get the uint16_t bitmap parameter. I've successfully loaded a .bmp file off of an SD card. But it seems to be loaded as an int type and I'm not sure how to convert it to the uint16_t requirement.

drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
      int16_t w, int16_t h)

notbrian:
I've successfully loaded a .bmp file off of an SD card.

Do you? Can't see it... So how should I help?

See instructions here to convert a bmp file to an array fit to Adafruit GFX.

lcd-image-converter
Features

  • Create a single image;
  • Create fonts (set of images - characters), including Unicode;
  • Monochrome, grayscale, color;
  • With vertical and horizontal orientation of bytes;
  • 8, 16, 24, 32-bit data size;
  • 1…32 bits per pixel;
  • RLE compression;
  • For different display controllers, not limited by one particular model.
  • Custom “C” template for output.

lesept:
See instructions here to convert a bmp file to an array fit to Adafruit GFX.

lcd-image-converter
Features

  • Create a single image;
  • Create fonts (set of images - characters), including Unicode;
  • Monochrome, grayscale, color;
  • With vertical and horizontal orientation of bytes;
  • 8, 16, 24, 32-bit data size;
  • 1…32 bits per pixel;
  • RLE compression;
  • For different display controllers, not limited by one particular model.
  • Custom “C” template for output.

Hey this is great, I saw a couple of posts and tutorials like this already but I’m wondering if there’s any way to load these programmatically off an SD card instead of putting it all into one project file.

The reason being I’m ultimately trying to play a GIF/Frame Sequence on my screen. I planned to just have a folder of every frame and load those onto the screen on an interval to achieve a sort of playback.

septillion:
Do you? Can’t see it… So how should I help?

Sorry about that, I didn’t have access to the code when I made this post.

This is my code that loads the bitmap file from my SD card. It successfully loads the file but its not the type I need which is uint16_t.

#include <SD.h>

#define sd_cs 13

File myFile;
void setup(void) {

 Serial.begin(9600);
 while(!Serial) {
   
 }

 Serial.print("Initializing SD card...");

 if (!SD.begin(sd_cs)) {
   Serial.println("failed!");
   return;
 }

 Serial.println("OK!");

 myFile = SD.open("visage.bmp");
 if(myFile) {

    Serial.println("loaded");

     while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    Serial.println("error");
  } 
}