To display an image in OLED display first We need to convert the image to HEX code, for that purpose We need to use a converter like image2cpp by javlImage2cpp
Step 1: Open Converter
Click on the image2cpp button and open the application in a new tab.
Step 2: Choose Image File
Click on choose files and choose the image file which you need to display in the OLED.
I just opened a facebook logo image
Step 3: Image Settings
Below is the screenshot of the default settings when We open the facebook logo.
Here We need to change at least the canvas size, scaling, and brightness threshold to get a proper output in our OLED display.
Canvas Size: it is the size of our OLED display in my case its 128×64 is you are using any other OLED display then change the settings accordingly
Brightness Threshold: It is for adjusting the intensity with respect to the background, you can understand it correctly with using the application.
Scaling: It is for adjusting the image size with respect to the Canvas Size.
Below is the screenshot after updating the settings.
Now We got our nice-looking Facebook logo, I have to change the canvas size to “128 x 64”, brightness threshold to “185”, scaling to “scale to fit, keeping proportion”. The other settings like center, background color and invert image colors are for tweaking, play with it to understand :).
Step 4: Generate Code
From code output, formate dropdown menu selects the Arduino code and click on the Generate code button.
Now We have successfully generated the HEX code for our image, Let’s move to Arduino coding.
Copy the code below to a new Arduino sketch
Now copy the above-generated HEX code just above the void Setup() function in the Arduino code. so it will look like this
Now select the board and port from the tools menu and upload the code, that’s it now Our OLED will start displaying the image.
Complete video tutorial
Note: If you don’t know to interface OLED with Arduino click here