Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Image
- im = Image.open("image.jpg")
- if im.size == (7200, 4800):
- out = im.resize((3300,2200), Image.ANTIALIAS)
- elif im.size == (4800,7200):
- out = im.resize((2200,3300), Image.ANTIALIAS)
- out.show()
- dpi = im.info['dpi'] # Warning, throws KeyError if no DPI was set to begin with
- # resize, etc.
- out.save("out.jpg", dpi=dpi)
Add Comment
Please, Sign In to add comment