mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-29 09:23:11 +03:00
Removed ignores
This commit is contained in:
parent
7e14364cee
commit
eb56f3ed56
|
@ -2074,9 +2074,8 @@ class Image:
|
||||||
if self.mode == "PA":
|
if self.mode == "PA":
|
||||||
alpha = value[3] if len(value) == 4 else 255
|
alpha = value[3] if len(value) == 4 else 255
|
||||||
value = value[:3]
|
value = value[:3]
|
||||||
value = self.palette.getcolor(value, self)
|
palette_index = self.palette.getcolor(value, self)
|
||||||
if self.mode == "PA":
|
value = (palette_index, alpha) if self.mode == "PA" else palette_index
|
||||||
value = (value, alpha) # type: ignore[assignment]
|
|
||||||
return self.im.putpixel(xy, value)
|
return self.im.putpixel(xy, value)
|
||||||
|
|
||||||
def remap_palette(self, dest_map, source_palette=None):
|
def remap_palette(self, dest_map, source_palette=None):
|
||||||
|
|
|
@ -33,6 +33,7 @@ def grab(
|
||||||
all_screens: bool = False,
|
all_screens: bool = False,
|
||||||
xdisplay: str | None = None,
|
xdisplay: str | None = None,
|
||||||
) -> Image.Image:
|
) -> Image.Image:
|
||||||
|
im: Image.Image
|
||||||
if xdisplay is None:
|
if xdisplay is None:
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
fh, filepath = tempfile.mkstemp(".png")
|
fh, filepath = tempfile.mkstemp(".png")
|
||||||
|
@ -42,7 +43,7 @@ def grab(
|
||||||
left, top, right, bottom = bbox
|
left, top, right, bottom = bbox
|
||||||
args += ["-R", f"{left},{top},{right-left},{bottom-top}"]
|
args += ["-R", f"{left},{top},{right-left},{bottom-top}"]
|
||||||
subprocess.call(args + ["-x", filepath])
|
subprocess.call(args + ["-x", filepath])
|
||||||
im: Image.Image = Image.open(filepath)
|
im = Image.open(filepath)
|
||||||
im.load()
|
im.load()
|
||||||
os.unlink(filepath)
|
os.unlink(filepath)
|
||||||
if bbox:
|
if bbox:
|
||||||
|
@ -84,7 +85,7 @@ def grab(
|
||||||
fh, filepath = tempfile.mkstemp(".png")
|
fh, filepath = tempfile.mkstemp(".png")
|
||||||
os.close(fh)
|
os.close(fh)
|
||||||
subprocess.call(["gnome-screenshot", "-f", filepath])
|
subprocess.call(["gnome-screenshot", "-f", filepath])
|
||||||
im: Image.Image = Image.open(filepath) # type: ignore[no-redef, unused-ignore]
|
im = Image.open(filepath)
|
||||||
im.load()
|
im.load()
|
||||||
os.unlink(filepath)
|
os.unlink(filepath)
|
||||||
if bbox:
|
if bbox:
|
||||||
|
|
|
@ -107,9 +107,8 @@ class PyAccess:
|
||||||
if self._im.mode == "PA":
|
if self._im.mode == "PA":
|
||||||
alpha = color[3] if len(color) == 4 else 255
|
alpha = color[3] if len(color) == 4 else 255
|
||||||
color = color[:3]
|
color = color[:3]
|
||||||
color = self._palette.getcolor(color, self._img)
|
palette_index = self._palette.getcolor(color, self._img)
|
||||||
if self._im.mode == "PA":
|
color = (palette_index, alpha) if self._im.mode == "PA" else palette_index
|
||||||
color = (color, alpha) # type: ignore[assignment]
|
|
||||||
|
|
||||||
return self.set_pixel(x, y, color)
|
return self.set_pixel(x, y, color)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user