adafruit / DotStarPiPainter

Light painting project for Raspberry Pi + DotStar strips
14 stars 6 forks source link

Changing img.tostring() to img.tobytes() will affect the LED output? #2

Open SandroMiccoli opened 6 years ago

SandroMiccoli commented 6 years ago

I'm setting up my RaspberryPi 3 (Model B V1.2) to test the DotStarPiPainter.py code and I got this error:

Loading 'case.jpg'...
    1300x2000 pixels
    Resizing... now 1300x144 pixels
Traceback (most recent call last):
  File "DotStarPiPainter.py", line 223, in <module>
    scandir() # USB drive might already be inserted
  File "DotStarPiPainter.py", line 142, in scandir
    lightpaint = loadImage(imgNum) # Load first image
  File "DotStarPiPainter.py", line 168, in loadImage
    pixels = img.tostring()
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 697, in tostring
    "Please call tobytes() instead.")
NotImplementedError: tostring() has been removed. Please call tobytes() instead.

Changing the function img.tostring() to img.tobytes() will break the code? Should I change the version of python (2.7) that I'm using?

I changed the function, ran the code again and got this:

Loading 'case.jpg'...
    1300x2000 pixels
    Resizing... now 1300x144 pixels
    0.301721 seconds
Processing...
    0.187877 seconds
Ready!

Apparently, it worked fine, but I'm not sure how this will affect the output to the LEDs...