使用批处理文件中的Imagemagick从PNG序列创建分层PSD

时间:2015-12-18 14:52:59

标签: windows batch-file command-line imagemagick psd

我正在使用动画软件将动画输出为标记为filename-001.png,filename-002.png等的PNG序列。我想使用imagemagick的 convert 来编译PSD所以我可以在Photoshop中快速编辑它。

我需要Windows批处理文件从批处理文件所在的文件夹中获取所有png文件(或者拖放序列中的第一个图像或拖放文件夹)并将它们转换为分层PSD文件

理想情况下,标签应该是文件名部分(例如,对于第2层=“filename-002”)

目前我的批次如下:

convert
( -page +0+0 -label "label1" "filename-001.png"[0] -background none -mosaic -set colorspace RGB )
( -page +0+0 -label "label2" "filename-002.png"[0] -background none -mosaic -set colorspace RGB )
( -page +0+0 -label "label3" "filename-003.png"[0] -background none -mosaic -set colorspace RGB )
( -page +0+0 -label "label4" "filename-004.png"[0] -background none -mosaic -set colorspace RGB )
( -clone 0--1 -background none -mosaic ) -reverse "out.psd"

这当然会转换我手动输入的png图像,我需要更加自动化。

最后,生成的PSD的图层不透明度,我希望它们不被锁定,这样我就可以在Photoshop中更快地编辑PSD。

1 个答案:

答案 0 :(得分:3)

你可以尝试这个,虽然我无法测试它,因为我自己没有imagemagic:

@echo off
setlocal enabledelayedexpansion
set number=1
set "command=convert"
for %%f in (*.png) do (
  set "command=!command! ^( -page +0+0 -label ^"label!number!^" ^"%%~nxf^"[0] -background none -mosaic -set colorspace RGB ^)"
  set /a number=!number!+1
)
set "command=%command% ^( -clone 0--1 -background none -mosaic ^) -reverse ^"out.psd^""
%command%
pause

我认为可以找到不透明度问题here