R
R
RandomProgrammer2021-10-11 14:53:26
Python
RandomProgrammer, 2021-10-11 14:53:26

PIL module changed?

I used to load pixels:
pixels = im.load()
and in a loop I could take channels:
r, g, b = pixels[i, j]
However, now this line gives an error:
TypeError: cannot unpack non-iterable int object
How to get pixel channels now?

Please pay more attention to this issue.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RandomProgrammer, 2021-10-11
@RandomProgrammer

I would never have thought, but it turns out that the picture I used had less color depth than a regular picture! I need to be more careful with things like this.

E
Evgeny Akulinin, 2021-10-11
@forkhammer

Channels are taken via split() https://pillow.readthedocs.io/en/stable/reference/...
r, g, b = im.split()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question