virtualabs / pixoo-client

Divoom Pixoo Client for Python3
61 stars 13 forks source link

IndexError: image index out of range #5

Open LordOfTheSnow opened 2 years ago

LordOfTheSnow commented 2 years ago

Could you please provide a little more info how to use your example program?

After a lot of hassling around with the bluetooth connection (finally had to run your program with sudo privileges) I get this error message:

IndexError: image index out of range

This is the callstack:

sudo python3 pixoo.py 11:75:58:BB:BF:71 cropped-icon-16x16.png
Traceback (most recent call last):
  File "pixoo.py", line 320, in <module>
    pixoo.draw_pic(img_path)
  File "pixoo.py", line 231, in draw_pic
    nb_colors, palette, pixel_data = self.encode_image(filepath)
  File "pixoo.py", line 247, in encode_image
    return self.encode_raw_image(img)
  File "pixoo.py", line 265, in encode_raw_image
    pix = img.getpixel((x,y))
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 1315, in getpixel
    return self.im.getpixel(xy)
IndexError: image index out of range

This is the image that I tried:

cropped-icon-16x16

LordOfTheSnow commented 2 years ago

OK, I found out I had to change the class from PixooMax to Pixoo

pixoo = Pixoo(pixoo_baddr)

Now it works, even without sudo privileges.

Do you plan to implement some other basic functions such as displaying date and time or adding a scrolling text?