1
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)

enter image description here

new one (1200x630):

enter image description here

0

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

But in this the quality is lost during the resize

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.