Hi Terry,

> So if I've understood what you are saying correctly, it's the for loop that's 
> out of range and not the image (as such).  It simply keeps looping round 
> until 
> it gets to 128 and if there are no more pixels after 95 it barfs?

Yes.

> >    289      Pixels = Image.load()

I'm assuming you're using PIL, or something similar.
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.

-- 
Cheers, Ralph.

-- 
  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

Reply via email to