【问题标题】:How to save multi-layer PSD with Python/ImageMagick/Wand如何使用 Python/ImageMagick/Wand 保存多层 PSD
【发布时间】:2021-05-07 16:52:53
【问题描述】:
我需要使用 Python 保存一个多层 PSD。我发现的唯一解决方案是使用 ImageMagick,因为 Python PSD 库(例如 psd-tools 和 psd-tools3)不支持图层写入。
使用 ImageMagick 的命令是:
convert ./image1.png ./image2.png ./image3.jpg -clone 0 final.psd
但我无法找到如何在 Python/Wand 代码中翻译此类命令。
【问题讨论】:
标签:
python
image
imagemagick
【解决方案1】:
wand 的可能解决方案类似于..
from wand.image import Image
with Image(filename="./image1.png") as img:
img.read(filename="./image2.png")
img.read(filename="./image3.jpg")
img.read(filename="./image1.png") # -clone 0
img.save(filename="final.psd")
.. 但我确信有更清洁的方法。