-
-
Save jesliwang/6e4f070eeaf5bdf3871e3e689b945261 to your computer and use it in GitHub Desktop.
批量修改图片尺寸
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/Jesli/anaconda2/bin/python | |
# -*- coding: utf-8 -*- | |
# pip install pillow | |
from PIL import Image | |
image_size = [36, 48, 72, 96, 144, 192] | |
def start(): | |
for size in image_size: | |
create_image(size,) | |
def create_image(size): | |
pri_image = Image.open("origin.jpg") | |
resize_image = pri_image.resize((size, size), Image.ANTIALIAS) | |
resize_image.save("img/png_%d.png" % size) | |
if __name__ == "__main__": | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment