Skip to content

Instantly share code, notes, and snippets.

@keewon
Created July 28, 2022 20:10
Show Gist options
  • Save keewon/4c21023c922c8029c62886d418790d47 to your computer and use it in GitHub Desktop.
Save keewon/4c21023c922c8029c62886d418790d47 to your computer and use it in GitHub Desktop.
from PIL import Image
original_11 = "1024.png"
original_43 = "1024x768.png"
im = Image.open(original_11)
variants_11 = [
58,
87,
]
variants = [
(120, 90),
(180, 135),
(134, 100),
(148, 110),
(54, 40),
(81, 60),
(64, 48),
(96, 72),
]
for v in variants_11:
im = Image.open(original_11)
n = im.resize((v, v), Image.ANTIALIAS)
n.save("{}x{}.png".format(v, v))
for (x,y) in variants:
im = Image.open(original_43)
n = im.resize((x, y), Image.ANTIALIAS)
n.save("{}x{}.png".format(x, y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment