StylMorph logoStylMorph.

Image to C Array Converter

Prepare a monochrome bitmap for an Arduino or ESP display. Set the pixel size and threshold, inspect the result and download a horizontal C array.

Open the tool
A sailboat photo beside an illustrated monochrome OLED version
Choose a photo to get started

PNG, JPG or WebP · up to 10 MiB and 24 megapixels

Free · no account required · processed in your browser · your photo stays on your device.

Photo converted into an OLED bitmap illustration

Choose your photo or try the sample to create a result here.

Prepare pixels your display library can read

A small monochrome display needs a one-bit drawing and a byte order that matches its graphics library. This workspace converts one photo or icon into a thresholded bitmap and a C header. It is useful for simple silhouettes, badges and high-contrast logos on Arduino or ESP projects.

  1. Set the display size

    Choose whole pixel dimensions from 8 to 256 on each side. Match the size you intend to pass to your drawing function. “Keep the whole image” adds white margins when the shape differs; “Fill” crops the outer edges.

  2. Inspect the one-bit preview

    Threshold controls which source tones become black. Raise it to include lighter details, lower it for fewer dark pixels, and invert when your foreground/background convention requires it. Use a simple icon if photo detail disappears at a small size.

  3. Export the header and match the function

    The header contains horizontal rows, most-significant bit first, with one representing foreground. It includes the dimensions and an Adafruit GFX drawBitmap example. Use that format with a compatible function, then verify the orientation on the actual hardware.

Try this with the sample

Try the landscape sample at 128 × 64. Compare threshold 90 with 170 and watch which mountain and water details survive. Keep the full image first, then try Fill to see the crop. The header stores 1,024 bytes for this size. Test the included drawBitmap call in your own existing display sketch.

Try the settings
The sample landscape reduced to a monochrome bitmap
Actual workspace output at 128 × 64, enlarged for inspection.

Choose the right bitmap format

Horizontal versus vertical bytes
This export packs each row left to right, eight pixels per byte, with zero padding at the right. A driver that expects vertical pages needs a different packing mode. Use the original image2cpp project when you need those additional formats.
A width that is not divisible by eight
Each row takes ceil(width ÷ 8) bytes. A 13 × 10 image therefore takes 2 × 10 = 20 bitmap bytes. Its three padding bits per row remain zero; the drawing function still receives width 13.
A photograph versus an icon
Small displays retain silhouettes better than subtle textures. Crop to one subject and increase useful separation before converting. A 128 × 64 preview has 8,192 on/off pixels, so fine type and soft shadows need careful checking.
Display memory and code size
128 × 64 uses 1,024 raw bitmap bytes in this horizontal format. The header text itself is larger because it writes each byte as readable hexadecimal. Storage attributes and actual memory use depend on your compiler and target.

Read the array with a compatible drawing function

The original image2cpp project explains its additional conversion settings. For this workspace’s horizontal output, match the dimensions in your header to a compatible Adafruit GFX bitmap function. The header uses horizontal, MSB-first rows, with black pixels stored as 1. Match the dimensions and byte format to your drawing function, then check orientation and foreground color on your connected display.

Frequently asked questions

Can I export the monochrome preview as an image?

This focused exporter downloads the C header. For a separate raster image, use the browser preview as a reference or return to your original image editor.

Can I convert multiple icons at once?

This workspace converts one image at a time. Keep each exported header with its corresponding source image and dimensions. The original image2cpp project offers additional batch settings.

Is this the original image2cpp?

This is StylMorph’s focused image-to-C-array workspace. The original image2cpp project by javl provides additional formats, multiple-image conversion and array reading; its source is linked below.

Will this initialize my Arduino display?

The export supplies a bitmap and an example drawing call. Initialize your display with its existing driver, correct pins, address and dimensions before using the array.

Why is the display scrambled?

Check that the width and height in the drawing call match the header, and that the function expects horizontal MSB-first data. Check rotation and foreground color after confirming the byte format.

Can I convert a color image?

Yes. The tool converts its tones to a black-and-white threshold preview. The C array stores one bit per pixel; color display formats such as RGB565 need a different exporter.

Can I copy the code instead of downloading?

Use Copy C array. If clipboard permission is unavailable, open “View generated C array”, select the code and copy it with your keyboard.

Are my images uploaded?

Image decoding, thresholding and header creation run locally in your browser.

Related tools and guides

Working with a color game sprite?

MakeCode Arcade uses palette indices and img code. Use the dedicated image converter for that project.

Working with a color game sprite?