Python - Cannot unpack non-iterable int object
问题 I'm trying to get an Image's pixel RGB with the PIL Image Library. With this code, I ran into the error: for i in range(width): for j in range(height): r,g,b=(image.getpixel((i,j))) #THIS LINE IS REFERENCED IN ERROR MESSAGE print("leds[",j,"] = CRGB(",r, "," ,g, ",", b, ");") #print pixel colorchange to console del image Why do I get this error? To me, this seems really strange. I input 2 images and it works just fine. However when I have white pixels at a certain position in the image, I get