On Monday, 3 August 2020 17:14:36 BST Ralph Corderoy wrote: > I'm assuming you're using PIL, or something similar.
Yes. As you suggested, I temporarily changed the value of OLED_Y_MAXPIXEL in OLED_Driver.py and the image now renders without any errors. However, I think it has too many grey levels because I get a very washed out picture with the odd line on it. The spec says 16 bit, but I think they mean 16 levels (needless to say the device came from China). I'm going to have to look into all this tomorrow because I'm going to be busy this evening. > load() returns an object which supports two-dimensional indexing to > retrieve pixel values; see > http://effbot.org/imagingbook/image.htm#tag-Image.Image.load > > If it's not PIL, it may be Pillow, a later fork. > > I think it's the implementation of the 2D indexing which is giving you > the ‘image index out of range’ exception string. It's not referring to > a variable called ‘image’. > > Another option is to use your image-loading library to manipulate the > loaded image to fit within 128×128 rather than mess with Gimp, which is > presumably GUI clicking. > > Something like > > pic = Image.open('big.png') > pic.thumbnail((128, 128), Image.ANTIALIAS) > tv = pic.convert('P', palette=ADAPTIVE, colors=16) > > Then try passsing tv to OLED_ShowImage(). Hopefully, its tv.load() will > be a no-op as nothing needs loading. I'll look into this tomorrow too. Thanks for your help. -- Terry Coles -- Next meeting: Online, Jitsi, Tuesday, 2020-08-04 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk