如何使用 Python/ImageMagick/Wand 保存多層 PSD (How to save multi-layer PSD with Python/ImageMagick/Wand)


問題描述

如何使用 Python/ImageMagick/Wand 保存多層 PSD (How to save multi‑layer PSD with Python/ImageMagick/Wand)

我需要使用 Python 保存一個多層 PSD。我找到的唯一解決方案是使用 ImageMagick,因為 Python PSD 庫(例如 psd‑tools 和 psd‑tools3)不支持圖層編寫。使用 ImageMagick,命令是:

convert ./image1.png ./image2.png ./image3.jpg ‑clone 0 final.psd

但我無法找到如何在 Python/Wand 代碼中翻譯此類命令。


參考解法

方法 1:

Possible solution with wand would be something like..

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")

</code></pre>

.. but I"m sure there's cleaner ways.

(by Nicoemcconville)

參考文件

  1. How to save multi‑layer PSD with Python/ImageMagick/Wand (CC BY‑SA 2.5/3.0/4.0)

#imagemagick #Python #image






相關問題

PHP ImageMagick setColorspace 不起作用 (PHP ImageMagick setColorspace not working)

從 Magick++ 圖像從內存 (libharu) 加載圖像 (Load Images from memory (libharu) from Magick++ images)

ImageMagick PDF to JPGs 有時會導致黑色背景 (ImageMagick PDF to JPGs sometimes results in black background)

使用 ImageMagick 改進從平面圖像到 3d 模型的轉換鏈 (Improve this conversion chain from flat images to 3d mockup with ImageMagick)

WampServer 和 Imagemagick,無法識別 imagick php 模塊 (WampServer and Imagemagick, imagick php module not recogized)

PHP Imagick - 顯示多圖像 TIFF 的第一片 (PHP Imagick - display first slice of mutli image TIFF)

打印 imagemagick 將輸出轉換為瀏覽器 (print imagemagick convert output to browser)

創建 ImageMagick Linux 腳本 (Create ImageMagick Linux script)

從照片生成漂亮的直方圖? (generating nice looking histogram from photo?)

iPhone中的imagemagick單色轉換 (imagemagick monochrome convert in iPhone)

為什麼從 PHP 腳本調用 (ImageMagick) convert.exe 會導致頁面無響應? (Why is calling (ImageMagick) convert.exe from PHP script resulting in an unresponsive page?)

如何使用 Python/ImageMagick/Wand 保存多層 PSD (How to save multi-layer PSD with Python/ImageMagick/Wand)







留言討論