A maker-first image-to-C++ converter built for embedded developers. Drop in any PNG/JPG/BMP, choose your display (SSD1306 OLED, Waveshare e-paper, ILI9341 TFT, and more), tune dithering in real time, and copy a ready-to-paste PROGMEM byte array straight into your Arduino, ESP32, STM32, or Raspberry Pi Pico sketch. Everything runs locally β no uploads, no tracking, no limits.
Try it live at pixel.hjlabs.in β no signup, free forever.
π Live Demo Β· β¨ Features Β· π Installation Β· π Architecture Β· π‘ Use Cases Β· π¬ Contact
Embedded developers working with 128x64 SSD1306 OLEDs or e-paper displays face the same problem every time: "how do I turn this logo PNG into a const uint8_t PROGMEM array that my microcontroller can draw?"
Image2CPP solves it. Drop an image, pick your display spec and orientation, preview the 1-bit dithered output in real time, and copy the generated C/C++ array straight into your sketch. Because it's fully client-side, you can use it on sensitive design files without worrying about them leaving your machine.
The fastest way to get a logo, icon, or splash screen onto a 128x64 OLED β from drag-and-drop to working sketch in 30 seconds.
|
|
|
|
| Use Case | Description |
|---|---|
| Building an ESP32 smart-home dashboard | Convert weather icons and app logos for a 128x64 OLED status screen |
| Designing a custom Arduino badge / wearable | Rapidly iterate on splash-screen art and see dithering live |
| Waveshare e-paper projects | Generate 1-bit assets with proper dithering for crisp e-ink rendering |
| Retro handhelds & PICO-8 style devices | Turn pixel art into ready-to-use C arrays for ILI9341 / ST7789 TFTs |
| Hackathon prototypes | Skip the toolchain wrestling β just drag, drop, copy, compile |
ββββββββββββββββββββββββββββββββββββββββββ
β User's Browser β
β βββββββββββββββββββββββββββββββββββ β
β β Canvas API β image decode β β
β β Dithering algorithms (JS) β β
β β Byte-array serializer β β
β βββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββ¬ββββββββββββββββββββββ
β Only HTML/CSS/JS served
ββββββββββββββββββββΌββββββββββββββββββββββ
β Cloudflare Workers β
β βββββββββββββββββββββββββββββββββββ β
β β Static asset serving (edge) β β
β β Pageview counter (D1) β β
β βββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββ
Tech Stack:
- Runtime: Cloudflare Workers (serves the static bundle at the edge)
- Language: Vanilla JavaScript β no framework, no build step
- Image processing: HTML
<canvas>+ pure-JS dithering implementations - Storage: Cloudflare D1 for anonymous pageview analytics only
- Privacy: No image ever leaves the browser, not even to the Worker
- Node.js 18+
- Cloudflare account (free tier works)
wranglerCLI:npm install -g wrangler
# Clone the repository
git clone https://github.com/hemangjoshi37a/hjlabs.in-image2cpp.git
cd hjlabs.in-image2cpp
# Install dependencies
npm install
# Login to Cloudflare
npx wrangler login
# Run locally
npx wrangler dev
# Deploy to your Cloudflare account
npx wrangler deploy- (Optional) Create a D1 database for pageview stats:
npx wrangler d1 create hjlabs-analytics - Update
wrangler.tomlwith your Cloudflare account details - Point a subdomain CNAME at your deployed Worker
This is one of 5 free open-source micro-SaaS products in the hjLabs.in ecosystem:
| Product | URL | Description |
|---|---|---|
| π¨ OG Generator | og.hjlabs.in | Favicon & Open Graph image generator |
| π JSON Formatter | fmt.hjlabs.in | 15 free developer tools (JSON, JWT, Base64, etc) |
| πΌ Image Enhancer | enhance.hjlabs.in | AI photo enhancer + marketing image generator |
| βοΈ DPDPA Compliance | compliance.hjlabs.in | India DPDPA 2023 privacy policy generator |
| π Image2CPP | pixel.hjlabs.in | Convert images to C++ arrays for Arduino/ESP32 |
Plus the hjLabs.in AI/ML Services consulting site for AI/ML solutions for industrial automation, IoT, and SEO.
Contributions are welcome! Found a bug or have a feature idea? Please open an issue or PR.
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
You're free to use, modify, distribute, and even sell this project. Attribution appreciated but not required.
