Skip to content

Commit

Permalink
Updating to undo Pillow Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanStoves committed Jan 12, 2024
1 parent b74b5a4 commit 6d97497
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/img.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ def process_img(the_img_bytes, template_fp="res/template-f.png"):

# crop/resize the token image
width, height = img.size
if height >= width:
is_taller = height >= width
if is_taller:
box = (0, 0, width, width)
else:
box = (width / 2 - height / 2, 0, width / 2 + height / 2, height)
img = img.resize(TOKEN_SIZE, Image.Resampling.LANCZOS, box)
img = img.crop(box)
img = img.resize(TOKEN_SIZE, Image.ANTIALIAS)

# paste mask
mask_img = Image.open("res/alphatemplate.tif")
Expand Down

0 comments on commit 6d97497

Please sign in to comment.