change image resolution pillow
size = 7016, 4961
im = Image.open("my_image.png")
im_resized = im.resize(size, Image.ANTIALIAS)
im_resized.save("my_image_resized.png", "PNG")
change image resolution pillow
size = 7016, 4961
im = Image.open("my_image.png")
im_resized = im.resize(size, Image.ANTIALIAS)
im_resized.save("my_image_resized.png", "PNG")
This is the challenge section of the lab where you'll write a script that uses PIL to perform the following operations: Iterate through each file in the folder
import os
from PIL import Image
path = "\images\"
dst = "\opt\icons\"
current_dir = os.getcwd()
images = os.listdir(current_dir+path)
print(images)
for img in images:
im = Image.open(current_dir+path+img)
#im.show()
rotated_im = im.rotate(90)
#rotated_im.show()
resized_im = rotated_im.resize((128, 128))
#resized_im.show()
jpg_im = resized_im.convert("RGB")
#jpg_im.show()
jpg_im.save(fp=current_dir+dst+img[:-4]+'jpg', format='jpeg')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us