Skip to content

Commit

Permalink
fix: 字符画丢失透明度 (#58)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
balh55y and pre-commit-ci[bot] committed Oct 2, 2023
1 parent 80ac5ca commit 16fc164
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions meme_generator/memes/charpic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ def charpic(images: List[BuildImage], texts, args):
font = Font.find("Consolas").load_font(15)

def make(img: BuildImage) -> BuildImage:
img = img.convert("L").resize_width(150)
img = img.convert("RGBA").resize_width(150).convert("L")
img = img.resize((img.width, img.height // 2))
lines = []
for y in range(img.height):
line = ""
for x in range(img.width):
gray = img.image.getpixel((x, y))
line += str_map[int(num * gray / 256)]
line += str_map[int(num * gray / 256)] if gray != 0 else " "
lines.append(line)
text = "\n".join(lines)
text_img = Image.new("RGB", (2000, 2000), "white")
Expand Down

0 comments on commit 16fc164

Please sign in to comment.