diff --git a/src/PIL/Image.py b/src/PIL/Image.py index ccbfe2a6fd4..b92c0bb43b8 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -524,7 +524,7 @@ def size(self) -> tuple[int, int]: def mode(self): return self._mode - def _new(self, im: Image) -> Image: + def _new(self, im: Image): new = Image() new.im = im new._mode = im.mode @@ -1347,7 +1347,9 @@ def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int]: self.load() return self.im.getbbox(alpha_only) - def getcolors(self, maxcolors: int = 256) -> list[tuple[int, int]] | None: + def getcolors( + self, maxcolors: int = 256 + ) -> list[tuple[int, int | tuple[int, ...]]] | None: """ Returns a list of colors used in this image. @@ -1370,7 +1372,7 @@ def getcolors(self, maxcolors: int = 256) -> list[tuple[int, int]] | None: return out return self.im.getcolors(maxcolors) - def getdata(self, band: int | None = None) -> Image: + def getdata(self, band: int | None = None): """ Returns the contents of this image as a sequence object containing pixel values. The sequence object is flattened, so @@ -1393,7 +1395,7 @@ def getdata(self, band: int | None = None) -> Image: return self.im.getband(band) return self.im # could be abused - def getextrema(self) -> tuple[float, float] | tuple[tuple[float, float], ...]: + def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]: """ Gets the minimum and maximum pixel values for each band in the image.