Fix an issue with the new Pillow update#462
Conversation
| height = int.from_bytes(header[8:12], "big") | ||
| self._size = width, height | ||
| self.mode = "RGBA" | ||
| self._mode = "RGBA" |
There was a problem hiding this comment.
What does this mean from the release notes:
The
convertmethod is the correct way to change an image's mode.
There was a problem hiding this comment.
I believe that's for existing images, but not for creating our own image decoder. The documentation states
An image plugin should contain a format handler derived from the PIL.ImageFile.ImageFile base class. This class should provide an _open method, which reads the file header and set at least the internal _size and _mode attributes so that mode and size are populated.
so we should be safe setting these private attrs here. (famous last words, given this PR)
There was a problem hiding this comment.
Ah gotcha; yeah they set self._mode in their example, too.
| height = int.from_bytes(header[8:12], "big") | ||
| self._size = width, height | ||
| self.mode = "RGBA" | ||
| self._mode = "RGBA" |
There was a problem hiding this comment.
Ah gotcha; yeah they set self._mode in their example, too.
| raise NotImplementedError() | ||
|
|
||
| async def write_analog(self, pin: str, value: int, *, timeout: float | None = None, **kwargs): | ||
| raise NotImplementedError() |
There was a problem hiding this comment.
[q] how is this related to the mode change? just a drive-by?
There was a problem hiding this comment.
Yup -- docs tests were failing because of a missed update to the example server. My bad, should've noted [flyby]
Pillow pulled some nonsense by making a breaking change in a minor version. Oops on them. Panic! at the Robot Factory.