如何使用magick将图像序列淡入另一个cmd中?(How to fade an image sequence into another in cmd with magick?)
我是magick库的新手,而且这个cmd语法非常伤害我。 我试图达到以下目的:
我有2个文件夹,每个文件夹包含100个PNG文件。 我想像这样在这些图像之间平滑过渡:
第一个文件夹中的第一个图像应该与第一个图像在第一个不透明度为1%的文件夹中重叠。
第一个文件夹中的第45张图片应与45%不透明度的第二个文件夹中的第45张图片重叠,依此类推...
我的文件被命名为frame000.png,frame045.png(用零填充),这使问题更加复杂。
我尝试在批处理脚本和magick命令中实现这一组合for循环,但似乎没有任何事情发生,当我运行它时,它只是将此文本打印到cmd窗口100次:
SET NUM=x SET PADDED=00NUM SET PADDED=PADDED:~-3 magick composite -dissolve PADDEDPADDEDPADDEDPADDED.png
我认为问题出现在我的批处理语法中,但我无法弄清楚。 下面是我在render.bat中的内容:
FOR /L %%x IN (0,1,99) DO ^ SET NUM=%x ^ SET PADDED=00%NUM% ^ SET PADDED=%PADDED:~-3% ^ magick composite -dissolve %x -gravity Center "frl1/frame%PADDED%.png" "frl2/frame%PADDED%.png" -alpha SET "output/%PADDED%.png" pause
我尝试将变量引用更改为
%x
,%%x
,%x%
,但没有一个给了我正确的结果。I'm new to the magick library and also this cmd syntax hurts me so much. I'm trying to achieve the following:
I have 2 folders, each of them contains 100 png files. I want to render a smooth transition between these images like this:
The first image in the first folder should be overlapped with the first image in the second folder with 1% opacity.
The 45th image in the first folder should be overlapped with the 45th image in the second folder with 45% opacity, and so on...
My files are named like frame000.png, frame045.png (padded with zeros), which is further complicates the problem.
I try to achieve this combining a for loop in a batch script and a magick command, but it seems like nothing is happening, when I run it it just prints this text to the cmd window 100 times:
SET NUM=x SET PADDED=00NUM SET PADDED=PADDED:~-3 magick composite -dissolve PADDEDPADDEDPADDEDPADDED.png
I think the problem is in my batch syntax, but I can't figure it out. Heres what I have in render.bat:
FOR /L %%x IN (0,1,99) DO ^ SET NUM=%x ^ SET PADDED=00%NUM% ^ SET PADDED=%PADDED:~-3% ^ magick composite -dissolve %x -gravity Center "frl1/frame%PADDED%.png" "frl2/frame%PADDED%.png" -alpha SET "output/%PADDED%.png" pause
I tried changing the variable references to
%x
,%%x
,%x%
, but none of them gave me the correct results.
原文:https://stackoverflow.com/questions/49772090