【发布时间】:2013-06-26 07:29:21
【问题描述】:
Imagemagick 是用于显示、转换和编辑光栅图像文件的开源软件套件。 Wand 是基于 ctypes 的 Python ImageMagick 绑定。
如何获取使用 Wand 获得的图像文件列表?
例如,有一个 2 页的 PDF 文件 file.pdf,我将其转换为 2 个 JPEG 文件 file-0.jpg 和 file-1.jpg。我如何获得列表['file-0.jpg', 'file-1.jpg']?
目前我只是使用glob:
with Image(filename='file.pdf') as original:
with original.clone() as converted:
converted.format = 'jpeg'
converted.save(filename='file.jpg')
images = glob('*.jpg')
但也许通过 Wand 库本身有一种更惯用的方式。
【问题讨论】:
标签: python imagemagick magickwand wand