Last active
March 15, 2020 06:16
-
-
Save terrillo/5152a55eec7f06af430daafe0a30c846 to your computer and use it in GitHub Desktop.
resize-image-and-get-hex-color--resize
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
from resizeimage import resizeimage | |
from PIL import Image | |
image_path = './dog.jpeg' | |
new_max_width = 1800 | |
new_filename = './dog-1800.jpeg' | |
with open(image_path, 'r+b') as f: | |
with Image.open(f) as image: | |
# Resize | |
smaller_image = resizeimage.resize_width(image, new_max_width) | |
smaller_image.save(new_filename, image.format) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment