Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Open source editor for bitmap images

License

NotificationsYou must be signed in to change notification settings

pkolt/bitmap_editor

Repository files navigation

✨ Open source editor forbitmap images.

👍 Will help you create pictures for librariesU8g2 andAdafruit SSD1306.

👉Bitmap Editor website

Usage

Create bitmap from image

Draw image

Export bitmap

Export image

Download bitmap to your device

Download image

Examples

Arduino + Adafruit SSD1306

If you are using libraryAdafruit SSD1306:

#include<Wire.h>#include<Adafruit_GFX.h>#include<Adafruit_SSD1306.h>#defineSCREEN_WIDTH128// OLED display width, in pixels#defineSCREEN_HEIGHT64// OLED display height, in pixels#defineOLED_RESET -1// Reset pin # (or -1 if sharing Arduino reset pin)#defineSCREEN_ADDRESS0x3C///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32Adafruit_SSD1306display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);#defineBITMAP_WIDTH16#defineBITMAP_HEIGHT16staticconstunsignedchar PROGMEM bitmap[] = {0b00000001,0b00000000,0b00000011,0b10000000,0b00101001,0b00101000,0b00010001,0b00010000,0b00101001,0b00101000,0b00000101,0b01000000,0b01000011,0b10000100,0b11111111,0b11111110,0b01000011,0b10000100,0b00000101,0b01000000,0b00101001,0b00101000,0b00010001,0b00010000,0b00101001,0b00101000,0b00000011,0b10000000,0b00000001,0b00000000,0b00000000,0b00000000 };voidsetup() {  Serial.begin(9600);// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internallyif (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {    Serial.println(F("SSD1306 allocation failed"));for (;;)      ;// Don't proceed, loop forever  }  display.clearDisplay();  display.drawBitmap(0,0, bitmap, BITMAP_WIDTH, BITMAP_HEIGHT, SSD1306_WHITE);  display.display();}voidloop() {}

Arduino + U8g2

If you are using libraryU8g2:

#include<Arduino.h>#include<U8g2lib.h>#include<Wire.h>U8G2_SSD1306_128X64_NONAME_F_HW_I2Cu8g2(U8G2_R0,/* reset=*/U8X8_PIN_NONE);#defineBITMAP_WIDTH16#defineBITMAP_HEIGHT16staticconstunsignedchar PROGMEM bitmap[] = {0b10000000,0b00000000,0b11000000,0b00000001,0b10010100,0b00010100,0b10001000,0b00001000,0b10010100,0b00010100,0b10100000,0b00000010,0b11000010,0b00100001,0b11111111,0b01111111,0b11000010,0b00100001,0b10100000,0b00000010,0b10010100,0b00010100,0b10001000,0b00001000,0b10010100,0b00010100,0b11000000,0b00000001,0b10000000,0b00000000,0b00000000,0b00000000 };voidsetup(void) {pinMode(9, OUTPUT);digitalWrite(9,0);// default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0if (!u8g2.begin()) {    Serial.println(F("SSD1306 allocation failed"));for (;;)      ;// Don't proceed, loop forever  };  u8g2.clearDisplay();  u8g2.drawXBMP(0,0, BITMAP_WIDTH, BITMAP_HEIGHT, bitmap);  u8g2.sendBuffer();}voidloop(void) {}

Development

npm cinpm start

FAQ

Why my image show wrong?

Distorted image

For some LCD displays such as the SSD1306, the image width must be a multiple of 8. If this requirement is not met, you will see a wrong image when displayed.

Just use an image width that is a multiple of 8.

License

  • Bitmap Editor -MIT
  • Bootstrap icons -MIT

[8]ページ先頭

©2009-2025 Movatter.jp