Skip to content

Commit

Permalink
replace ANTIALIAS
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Aug 28, 2023
1 parent 3227828 commit 8fe4660
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pil_utils/build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def circle(self) -> "BuildImage":
mask = Image.new("L", (image.width * 5, image.height * 5), 0)
draw = ImageDraw.Draw(mask)
draw.ellipse((0, 0, mask.width, mask.height), 255)
mask = mask.resize(image.size, Image.ANTIALIAS)
mask = mask.resize(image.size, Resampling.LANCZOS)
bg = Image.new("RGBA", image.size, (255, 255, 255, 0))
return BuildImage(Image.composite(image, bg, mask))

Expand All @@ -163,7 +163,7 @@ def circle_corner(self, r: float) -> "BuildImage":
mask = Image.new("L", (image.width * 5, image.height * 5), 0)
draw = ImageDraw.Draw(mask)
draw.rounded_rectangle((0, 0, mask.width, mask.height), r * 5, fill=255)
mask = mask.resize(image.size, Image.ANTIALIAS)
mask = mask.resize(image.size, Resampling.LANCZOS)
bg = Image.new("RGBA", image.size, (255, 255, 255, 0))
return BuildImage(Image.composite(image, bg, mask))

Expand Down
3 changes: 2 additions & 1 deletion pil_utils/text2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from bbcode import Parser
from PIL import Image, ImageDraw
from PIL.Image import Image as IMG
from PIL.Image import Resampling
from PIL.ImageColor import colormap

from .fonts import Font, get_proper_font
Expand Down Expand Up @@ -74,7 +75,7 @@ def draw_on(self, img: IMG, pos: PosTypeInt):
embedded_color=True,
)
new_img = new_img.resize(
(int(self.width), int(self.height)), resample=Image.ANTIALIAS
(int(self.width), int(self.height)), resample=Resampling.LANCZOS
)
img.paste(new_img, pos, mask=new_img)
else:
Expand Down

0 comments on commit 8fe4660

Please sign in to comment.