Created
November 14, 2020 08:57
-
-
Save deeperlearner/9eb70b462df792b5c311a51497bd2399 to your computer and use it in GitHub Desktop.
photo_resizer.py
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
import sys | |
from pathlib import Path | |
from PIL import Image | |
# usage: python3 photo_resizer.py img.png | |
img_file = sys.argv[1] | |
path = Path(img_file) | |
assert path.parent == Path(), "The image must in the same directory with photo_resizer.py" | |
img = Image.open(img_file) | |
img = img.resize((img.size[0]//2, img.size[1]//2)) | |
img.save("LR_" + img_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment