The display has fairly modest specifications:
- Pixels - 128 x 128.
- Display area - 1.5inch (diagonal).
- Display dimensions - 34 mm x 30 mm.
- Display colour - White (16 grey levels (Note: Not 16-bit as stated in the Manual))
I'm still working on the best way to get a satisfactory image display, but the following factors are relevant. Any image downloaded from the Internet is usually in .jpg, .gif or .png format. The image must therefore be converted to 128 x 128 pixel format with dimensions approximately the same as the display dimensions. The image must then be converted to grey-scale with 16 colours (levels) in the palette. I've been using The Gimp to do this but Photoshop or other graphical software products should be equally suitable. I'm told that the conversion can also be done in software using the image loading library, (in other words pre-processing before the image is passed to the driver, but I haven't got my head round that yet.
It must be stressed that one of the key factors which is inviolate is the number of pixels in the image. By default the OLED_Driver.py has the dimensions set to match the display, eg:
Code: Select all
OLED_X_MAXPIXEL = 128 #OLED width maximum memory
OLED_Y_MAXPIXEL = 128 #OLED height maximum memory
The original image of Andy Pandy that I obtained from Pinterest reduced to 128 x 95 and this caused an error. I modified the height setting in the driver to 95 and the image loaded without error, but there was a border at the bottom (as you would expect). Obviously the image could be padded with grey stripes top and bottom to fit the display.
Another important factor is the number of grey levels. In the original, the colour levels were 256 (even though the image was black and white). When converted to grey-scale the 256 levels remained and the image displayed as an almost white screen with squiggles. Once I had converted the levels to 16 the image displayed was acceptable.
The physical size of the image seems less critical. The example image provided with the sample code was 45.2 x 45.2 mm, which is bigger than the available real estate, but the driver sorted that out OK. Before I fully understood what was going on, used those dimensions without error.
When I have sorted out a decent workflow, using The Gimp, I'll add it to the comments below. Perhaps anyone who uses a different tool could also share their experience.