https://github.com/thaisonho/img2rgb565
A image to RGB565 converter in Python.
https://github.com/thaisonho/img2rgb565
arduino esp32 rgb565 st7735
Last synced: about 2 months ago
JSON representation
A image to RGB565 converter in Python.
- Host: GitHub
- URL: https://github.com/thaisonho/img2rgb565
- Owner: thaisonho
- License: mit
- Created: 2025-08-17T12:35:41.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-17T13:10:34.000Z (10 months ago)
- Last Synced: 2025-08-17T15:10:35.956Z (10 months ago)
- Topics: arduino, esp32, rgb565, st7735
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# img2rgb565
A simple Python tool to convert images to RGB565 format for use with embedded displays (e.g., ST7735) and generate either Arduino C arrays or raw binary files.
## Features
- Convert images to RGB565 format
- Output as Arduino C array or raw binary file
- Optional image resizing
## Requirements
- Python 3.8+
- [Pillow](https://pypi.org/project/Pillow/)
- [NumPy](https://pypi.org/project/numpy/)
Install dependencies:
```bash
pip install -r requiremenst.txt
```
## Usage
```bash
python img2rgb565.py [--output ] [--resize WIDTH HEIGHT] [--name VAR_NAME]
```
- ``: Path to the input image file (e.g., PNG, JPG).
- `--output`, `-o`: Output binary file (e.g., `image.bin`). If omitted, Arduino code is printed to stdout.
- `--resize WIDTH HEIGHT`: Resize the image to the specified dimensions before conversion.
- `--name VAR_NAME`: Variable name for the Arduino array (default: `my_image`).
## Examples
**Generate Arduino C array:**
```bash
python img2rgb565.py mypic.png --resize 128 160 --name mypic
```
**Generate binary file:**
```bash
python img2rgb565.py mypic.png --resize 128 160 --output mypic.bin
```
## Output
- **Arduino C array:** Prints a `const uint16_t` array and image dimensions for direct use in Arduino sketches.
- **Binary file:** Creates a `.bin` file with RGB565 data (big-endian) for direct upload to embedded devices.
## License
MIT License