Importing color bitmps into 32 x 32 LED panel

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
howard123
 
Posts: 10
Joined: Tue Dec 03, 2013 1:01 am

Importing color bitmps into 32 x 32 LED panel

Post by howard123 »

I am trying to take re-sized color image in bmp for and import them into the RGB led panel.

I am using Segger bitmap converter for emWin (demo version). It outputs many different formats including 444 - 12 bit per pixel to C code (Hex)format and 565 high color. the 444 format does not produce proper colors or images (only blue pixels).

does anyone have ideas to render good color images in he panel from .bmp files?

User avatar
darbyb
 
Posts: 6
Joined: Tue Aug 12, 2014 9:42 pm

Re: Importing color bitmps into 32 x 32 LED panel

Post by darbyb »

Hi!, im no expert with these things, but am working with on a similar issue. This is code I've adapted from another users experiments which has been working for me:

Code: Select all

#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library

// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
#define CLK 11  // MUST be on PORTB!
#define OE  9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);


// define some bitmaps
namespace pacman {

// yellow
const uint16_t Y = matrix.Color333(0, 7, 0);
const uint16_t C = matrix.Color333(0, 0, 7);


// right facing pacman
const uint16_t chomp[32 * 32] = {
  
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, C, C, C, 0, 0, C, C, 0, 0, C, 0, C, C, 0, 0, C, C, 0, 0, 0, 0, 0, 0, C, C, 0, 0, 0, 
0, 0, 0, 0, C, C, C, 0, 0, C, C, 0, 0, C, 0, C, C, 0, C, C, 0, 0, 0, 0, 0, 0, 0, C, C, 0, 0, 0, 
0, 0, 0, 0, C, C, C, 0, 0, C, C, 0, 0, C, 0, 0, 0, 0, C, C, 0, 0, 0, 0, 0, 0, 0, C, C, 0, 0, 0, 
0, 0, 0, C, C, C, C, C, 0, 0, C, C, C, 0, 0, 0, 0, 0, 0, C, C, C, C, 0, 0, 0, 0, C, C, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

}
void setup() {
  matrix.begin();
  matrix.fillScreen(0);
  // draw the bitmap
  for (uint8_t y = 0; y < 32; ++y) {
    for (uint8_t x = 0; x < 32; ++x) {

      // this one works (but is not helpful)
      //matrix.drawPixel(x, y, pacman::Y);

      // this one fails (entire display remains black)
      matrix.drawPixel(x, y, pacman::chomp[y * 32 + x]);
    }
  }

}

void loop() {
  // nothing
}
To create the bitmap array, I've drawn my image in photoshop and saved it as a bmp, then opened it in software called 'the dot factory' which converts the image into somewhat usable text.

This text I then open in microsoft word and use it's find/replace feature to change the empty spaces into 0's, which can then be copied straight into my code.

I hope this helps!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”