# image2cpp

image2cpp is a simple tool to change images into byte arrays (or your array back into an image) for use with Arduino and (monochrome) displays such as OLEDs. It was originally made to work with the Adafruit OLED library. An example sketch for Arduino and this library can be found here.

More info (and credits) can be found in the Github repository. This is also where you can report any issues you might come across.

This tool also works offline. Simply save this page to your computer and open the file in your browser.

## 1. Select image

## or

## 1. Paste byte array

x px

## 2. Image Settings

Canvas size/s:

Only images file type are allowed
No files selected
Background color:
White Black
Invert image colors
Brightness threshold:
0 - 255; pixels with brightness above become white, below become black.
Scaling
Center:
horizontally vertically
NOTE: Centering the image only works when using a canvas larger than the selected image.

## 3. Preview

## 4. Output

Code output format
Adds some extra Arduino code around the output for easy copy-paste into this example. If multiple images are loaded, generates a byte array for each and appends a counter to the identifier.
Adds some extra Arduino code around the output for easy copy-paste. If multiple images are loaded, generates a single byte array.
Creates a `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.
First ASCII character (dec):
x advance:
Identifier:
Draw mode:
Horizontal Vertical
If your image looks all messed up on your display, like the image below, try the other mode.