Skip to content

hemangjoshi37a/hjlabs.in-image2cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”Œ Image2CPP β€” Arduino / ESP32 Image Converter

Convert images to C++ byte arrays for OLED, e-paper, and TFT displays β€” 100% in your browser.

Cloudflare Workers License: MIT Live Demo Stars


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



🎯 What is this?

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.


πŸ“Έ Screenshot

Image2CPP Screenshot


✨ Features

πŸ“Ÿ Display Presets

  • SSD1306 OLED (128x32, 128x64)
  • SH1106 OLED
  • Waveshare e-paper (various sizes)
  • ILI9341 TFT (240x320)
  • ST7789 TFT
  • Generic monochrome / 16-bit RGB565

πŸŽ› Dithering Algorithms

  • Floyd–Steinberg
  • Atkinson
  • Bayer (ordered)
  • Threshold (pure 1-bit)
  • Live preview as you adjust
  • Invert, rotate, scale, crop

πŸ’» Output Formats

  • Arduino PROGMEM byte array
  • Plain C const uint8_t[]
  • Adafruit GFX compatible
  • U8g2 bitmap format
  • RGB565 16-bit for colour TFTs
  • Horizontal / vertical byte orientation

πŸ”’ 100% Client-Side

  • No image ever uploaded
  • Works completely offline
  • No tracking, no ads
  • MIT licensed, self-hostable
  • Fast on slow internet / field work

πŸ’‘ Use Cases

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

πŸ“ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            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

πŸ›  Installation

Prerequisites

  • Node.js 18+
  • Cloudflare account (free tier works)
  • wrangler CLI: npm install -g wrangler

Quick Start

# 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

Environment Setup

  1. (Optional) Create a D1 database for pageview stats: npx wrangler d1 create hjlabs-analytics
  2. Update wrangler.toml with your Cloudflare account details
  3. Point a subdomain CNAME at your deployed Worker

🌐 Part of the hjLabs.in Ecosystem

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.


🀝 Contributing

Contributions are welcome! Found a bug or have a feature idea? Please open an issue or PR.

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

πŸ“„ License

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.



πŸ“¬ Contact

Hemang Joshi β€” Founder, hjLabs.in

Email LinkedIn YouTube WhatsApp Telegram


hjLabs.in β€” Industrial Automation | AI/ML | IoT | SEO Tools

Serving 15+ countries with a 4.9⭐ Google rating

Website GitHub LinkTree



Built with ❀️ by hjLabs.in β€” Open source SEO & developer tools for everyone


⭐ If this project helps you, please give it a star! ⭐

About

Convert images to C/C++ byte arrays for Arduino, ESP32, SSD1306 OLED - Live at https://pixel.hjlabs.in

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors