-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Lines 59 to 62 in 5a087cc
| # Keep pointer to im object to prevent dereferencing. | |
| self._im = img.im | |
| if self._im.mode == "P": | |
| self._palette = img.palette |
This code saves a reference to the image palette, but only for "P" mode images. I think it should probably check for "PA" here too. This saved palette is used later in this class, but again only for "P", not "PA".
Lines 91 to 97 in 5a087cc
| if ( | |
| self._im.mode == "P" | |
| and isinstance(color, (list, tuple)) | |
| and len(color) in [3, 4] | |
| ): | |
| # RGB or RGBA value for a P image | |
| color = self._palette.getcolor(color, self._img) |
I haven't checked if this palette reference is used outside of this class, though it is supposed to be private so hopefully not.