mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
Add type hints
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
b6c755df32
commit
008b28eb0c
|
@ -524,7 +524,7 @@ class Image:
|
||||||
def mode(self):
|
def mode(self):
|
||||||
return self._mode
|
return self._mode
|
||||||
|
|
||||||
def _new(self, im: Image) -> Image:
|
def _new(self, im: Image):
|
||||||
new = Image()
|
new = Image()
|
||||||
new.im = im
|
new.im = im
|
||||||
new._mode = im.mode
|
new._mode = im.mode
|
||||||
|
@ -1347,7 +1347,9 @@ class Image:
|
||||||
self.load()
|
self.load()
|
||||||
return self.im.getbbox(alpha_only)
|
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.
|
Returns a list of colors used in this image.
|
||||||
|
|
||||||
|
@ -1370,7 +1372,7 @@ class Image:
|
||||||
return out
|
return out
|
||||||
return self.im.getcolors(maxcolors)
|
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
|
Returns the contents of this image as a sequence object
|
||||||
containing pixel values. The sequence object is flattened, so
|
containing pixel values. The sequence object is flattened, so
|
||||||
|
@ -1393,7 +1395,7 @@ class Image:
|
||||||
return self.im.getband(band)
|
return self.im.getband(band)
|
||||||
return self.im # could be abused
|
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
|
Gets the minimum and maximum pixel values for each band in
|
||||||
the image.
|
the image.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user