【发布时间】:2018-07-10 18:24:27
【问题描述】:
我正在尝试调整 jpeg 图像的大小并放大框架。为此,我将调整大小应用到原始图像,然后将其组合到较新的图像上:
with Image(blob=binary_data) as img:
...
img.resize(width=new_width, height=long(2000))
# Compose image to enlarge frame
with Image(width=1571, height=2000, background=Color('white')) as dst_image:
...
dst_image.composite(img, x, 0)
img = dst_image
img.resolution = (300,300)
img.format = 'jpg'
jpeg_bin = img.make_blob()
最后,我希望分辨率为 300dpi。 Imagemagick 命令 “识别”显示分辨率为 300dpi,但它不是真的;确实,如果我打开它 使用 Gimp 时,它显示的分辨率为 72dpi。
我正在使用 Wand v.0.4.4。
我的代码错了吗? ...有什么想法吗?
【问题讨论】:
-
试试 EXIFTOOL 看看实际的密度/分辨率是多少。您可能还必须通过 wand 指定一组单位,例如像素每英寸。如果未指定,某些工具不知道如何解释密度/分辨率。见 wand.image.UNIT_TYPES
-
谢谢@fmw42 它有效,它在下面的答案中提供了有关修复的详细信息。