Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image python在不丢失清晰度的情况下调整图像大小_Image_Python 2.7_Python Imaging Library - Fatal编程技术网

Image python在不丢失清晰度的情况下调整图像大小

Image python在不丢失清晰度的情况下调整图像大小,image,python-2.7,python-imaging-library,Image,Python 2.7,Python Imaging Library,我想调整1200xauto的大小,而不丢失任何比例,因此图像必须保持其清晰度等 但是调整大小后的图像在锐度上会被破坏。我也使用了反别名,但没有改变。怎么可能不失去锐度 原始图像:(600x450) 新的(1200x630): 如果您试图将图像调整为比原始图像更大的尺寸,则质量降低是正常的 要将图像调整为较小的大小,您可以查看我创建的这个模块:,但在这个模块中,质量在调整大小过程中会丢失 from PIL import Image import sys image = Image.open(sy

我想调整1200xauto的大小,而不丢失任何比例,因此图像必须保持其清晰度等

但是调整大小后的图像在锐度上会被破坏。我也使用了
反别名
,但没有改变。怎么可能不失去锐度

原始图像:(600x450)

新的(1200x630):


如果您试图将图像调整为比原始图像更大的尺寸,则质量降低是正常的


要将图像调整为较小的大小,您可以查看我创建的这个模块:

,但在这个模块中,质量在调整大小过程中会丢失
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))