0

我想多次裁剪一张图片。我需要开始裁剪的位置取决于方程式:

startX = %x * 1024
startY = %y * 1024

我无法在命令行中实现它。这就是我得到的:

FOR /L %y IN (0,1,5) DO  
FOR /L %x IN (0,1,5) DO  
convert fireball.png -crop 2048x2048+(%x*1024)+(%y*1024)% fireball_(%x,%y).png

我正在使用 Windows 7 CMD。

4

1 回答 1

0

I fixed your syntax but I can't vouch for your algorithm. The % after the ) may be a typo but if it needs to be there then in cmd it needs to be doubled (as shown) to equal one %.

Note that CMD math is integer only and tops out at 2^31 - 1

FOR /L %%y IN (0,1,5) DO (
FOR /L %%x IN (0,1,5) DO (
convert fireball.png -crop 2048x2048+^(%%x*1024^)+^(%%y*1024^)%% fireball_^(%%x,%%y^).png
)
)
于 2013-10-07T04:51:24.493 回答