Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.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
Python 魔杖无法设置正确的图像分辨率_Python_Wand - Fatal编程技术网

Python 魔杖无法设置正确的图像分辨率

Python 魔杖无法设置正确的图像分辨率,python,wand,Python,Wand,我正在尝试创建分辨率为300dpi的新jpeg图像 with Image(width=300, height=300, background=Color('white'), units = 'pixelsperinch', resolution=(300,300)) as ImgBackground: ImgBackground.save(filename='ImgOut.jpg') 但是这个文件在photoshop中的分辨率仍然是72dpi/英寸 我不知道为什么。有什么想法吗?试试

我正在尝试创建分辨率为300dpi的新jpeg图像

with Image(width=300, height=300, background=Color('white'), units = 'pixelsperinch', 
resolution=(300,300)) as ImgBackground:
    ImgBackground.save(filename='ImgOut.jpg')
但是这个文件在photoshop中的分辨率仍然是72dpi/英寸

我不知道为什么。有什么想法吗?

试试下面的方法

图像(宽=300,高=300,背景为白色)作为img:
img.分辨率=300
img.units='pixelsperinch'
save(filename='output.jpg')
这对于Wand来说是一个奇怪的行为,因为构造函数中的参数是用于图像解码器的。如果您想影响图像编码器;然后在图像对象的实例上设置属性