비트맵 변환기란 무엇입니까?

Arduino 디스플레이 프로젝트를 위해 이미지를 흑백 비트맵으로 쉽게 변환하세요!

비트맵 변환기 기능
  1. 간단한 이미지 업로드
  2. 일반적인 디스플레이 해상도 또는 사용자 지정 크기 지원
  3. 4가지 디더링 알고리즘을 사용한 밝기 조절
  4. 원본 및 변환된 이미지의 실시간 미리보기
  5. Arduino 코드 생성 (PROGMEM 바이트 배열)

Bitmap Converter Example

이미지 비트맵 변환기

디스플레이 해상도
이미지 파일 선택

사용 방법

  1. 디스플레이 해상도: 디스플레이 해상도 선택:
  2. 이미지 파일 선택: 이미지 파일을 선택하세요:
  3. 밝기 조절:: 밝기 조절:
  4. 코드 생성: Arduino 코드 생성
  5. 생성된 Arduino 코드: 생성된 Arduino 코드


샘플 Arduino 코드 (U8g2 라이브러리)

이 예제는 인기 있는 U8g2 라이브러리와 함께 생성된 비트맵을 사용하는 방법을 보여줍니다.

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif


// Include the generated bitmap header file
// Make sure this file is in the same directory as your .ino file,
// or provide the correct path.
#include "bitmap.h" // <-- RENAME THIS to match the generated code's filename suggestion

// Example for SSD1306 I2C display (replace with your display constructor)
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

// OLED TEXT ROW number, vertical position
const byte ROW[5] = {0, 15, 31, 47, 63};

void setup(void) {
  Serial.begin(115200);
  u8g2.begin();
  Serial.println("u8g2 started");  
}

void loop(void) {
  u8g2.clearBuffer(); // clear the internal memory

  // Draw the bitmap at position (0, 0)
  // u8g2.drawXBMP(x_pos, y_pos, bitmap_width, bitmap_height, bitmap_data);
  // Use the width and height mentioned in the generated code comments.
  // NOTE: U8g2's drawXBMP expects MSB first data format.
  // If you checked "Swap bits (U8g2 LSB)", the generated data is LSB first.
  // U8g2 doesn't have a built-in function for LSB-first XBMP directly.
  // You might need a custom drawing function or ensure your U8g2 mode matches the data.
  // For standard usage with drawXBMP, leave "Swap bits" UNCHECKED.
  // The "Invert Colors" option affects the data itself, drawXBMP will draw it as is.
  u8g2.drawXBMP(0, 0, 128, 64, your_image_bitmap); // <-- Use the array name from generated code
  Serial.println("Code working!");
  u8g2.sendBuffer(); // transfer internal memory to the display
  delay(5000);
}
            

Note: U8g2's drawXBMP function requires data in LSB-first (Least Significant Bit first) format, which matches the standard XBM specification. If your image conversion tool defaults to MSB-first output, you will need to enable an option (like "Swap bits", "LSB first", or "XBM format") to generate the correct LSB-first data needed by drawXBMP. When the data is correctly formatted as LSB-first, you can use it directly with the standard drawXBMP function without needing custom code.. The "Invert Colors" option modifies the bitmap data itself; `drawXBMP` will render the inverted image if the option was checked during generation.