python调整图像大小而不会丢失锐度
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))
我想调整1200xauto的大小并且这不会失去任何比例图像必须保持其shartness等等。
i want to resize 1200xauto and this without losing any ratio so the image must keep its shartness etc etc.
但重新调整大小的图像会以某种方式在锐度中被破坏。我也使用 ANTIALIAS
,但没有变化。怎么可能不失去锐度?
but resized images are somehow destroyed in sharpness. I used ANTIALIAS
also, but no change. how is it possible not to lose the sharpness?
原始图片:(600x450)
original image: (600x450)
新的(1200x630):
new one (1200x630):
您正在尝试将图片尺寸调整为比原尺寸更大的尺寸,这是正常的,您可以放松质量。
You are trying to resize an image to a larger size than the original, it is normal that you loose quality.
要将图像尺寸调整为更小的尺寸,您可以查看我创建的这个模块: python-image-resize
To resize you image to a smaller size, you may have a look at this module I created: python-image-resize