from PIL import Image
import sys
image = Image.open(sys.argv[1])
basewidth = 1200
img = image
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize), Image.BICUBIC)
img.save('sompic1.jpg')
print "image to %s" % (str(img.size))
i want to resize 1200xauto and this without losing any ratio so the image must keep its shartness etc etc.
but resized images are somehow destroyed in sharpness. I used ANTIALIAS also, but no change. how is it possible not to lose the sharpness?
original image: (600x450)
new one (1200x630):
解决方案
You are trying to resize an image to a larger size than the original, it is normal that you loose quality.
To resize you image to a smaller size, you may have a look at this module I created: python-image-resize