image2cpp is a simple tool to convert images into byte arrays (and vice versa) for use with (monochrome) displays such as OLEDs on your Arduino or Raspberry Pi.
It was originally made to work with the Adafruit OLED library (for which your can find an example Arduino sketch here) but
has been expanded by the community to be useful in all kind of (embedded) projects.
More info (and credits) can be found in the Github repository. This is also where you can report any issues you might come across.
Did you find this tool useful? Feel free to support my open source software on Github, especially if used commercially.
1. Select image
You can import multiple images at once.
All processing is done locally in your browser: your images are not uploaded or stored anywhere online.
All processing is done locally in your browser: your images are not uploaded or stored anywhere online.
Add more images or continue to step 2
1. Paste existing byte array
x
px
Byte array is invalid (or empty).
If your image looks glitchy try changing the dimensions above and press the read button again.
Read images also appear at step 3 below for further processing.
Read images also appear at step 3 below for further processing.
2. Image Settings
Glyph name is used to identify the image in the output code.
Canvas size:
x
glyph name:
Only images file type are allowed
Select one or more images at step 1 first.
Used for parts of the canvas that are not covered by your image.
Centering the image only works when using a canvas larger than the original image.
Pixels with brightness above threshold turn white, below turn black (opaque/transparent for alpha mode).
Preview
No files selected
3. Output
If your image looks all messed up on your display, like the image below, try using a different mode.
Outputs just the raw bytes of the image(s).
Adds some extra Arduino code around the output.
If multiple images are loaded, generates a byte array for each and appends its glyph name (from step 2 above) to the identifier.
Adds some extra Arduino code around the output.
If multiple images are loaded, generates a single byte array.
Creates a
First ASCII character value is used only if a glyph identifier of length equal to 1 is not provided for each image. The value itself will be incremented by 1 for each glyph.
GFXbitmapFont formatted ouput. Used by a modified version of the Adafruit GFX library.
GitHub project and example here.
First ASCII character value is used only if a glyph identifier of length equal to 1 is not provided for each image. The value itself will be incremented by 1 for each glyph.
MSB -> LSB. Useful when working with the u8g2 library.
Set to 0 to wrap using the image's width instead, e.g. an 8px wide image adds a newline every 8th byte.
Add an ascii-art comment after each row of bytes. Forces one image row per output line, regardless of "Bytes per row".
Select one or more images at step 1 first.