如何在 ImageMagick 的多重裁剪过程中使用第一个图像序列
How to use the first image sequence in a multiple cropping process in ImageMagick
我想要调整大小、裁剪和连接非常多的图像。
我不想将中间结果写入磁盘,只是最终结果。
我的脚本是:
montage -mode concatenate \
\( test.jpg -thumbnail "150x100>" -background white -gravity center -extent 150x100 -page 150x100+0+0 \) \
\( -clone 0 -crop 23x16+80+0 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+16+87 -background white -extent 23x16 \) \
...
-delete 0 -quality 100% thumb.jpg
我总是遇到以下错误:
montage.im6: geometry does not contain image `test.jpg' @ warning/transform.c/CropImage/574.
我尝试使用 "repage" 和 "page" 参数,但没有成功。
有什么想法吗?
更新
马克要求举例。所以我试着写下我想在一个步骤中合并的不同步骤:
convert logo: test.jpg
convert test.jpg -thumbnail "150x100>" -background white -gravity center -extent 150x100 -page 150x100+0+0 test.resized.jpg
montage -mode concatenate test.resized.jpg \
\( -clone 0 -crop 23x16+80+20 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+92+74 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+100+80 -background white -extent 23x16 \) \
-delete 0 -quality 100% result.thumb.jpg
我必须承认这个让我迷惑了!我无法让它像你尝试的那样工作,或者我根本不想这样做。我发现只有添加 +repage
才能使它工作,但如果我这样做,它会 忘记 -extent
,所以我一直以 2 个命令结束.我还发现 +clone
拒绝在这个例子中代替 -clone 0
工作,这也让我很困惑。
唯一能让它工作并避免中间文件的方法是将第一个 convert
的输出流式传输到第二个。
convert logo: -resize "150x100>" -background white -gravity center -extent 150x100 JPG:- | \
convert JPG:- \
\( -clone 0 -crop 23x16+80+20 \) \
\( -clone 0 -crop 23x16+92+74 \) \
\( -clone 0 -crop 23x16+100+80 \) \
-delete 0 +append out.jpg
我想要调整大小、裁剪和连接非常多的图像。 我不想将中间结果写入磁盘,只是最终结果。
我的脚本是:
montage -mode concatenate \
\( test.jpg -thumbnail "150x100>" -background white -gravity center -extent 150x100 -page 150x100+0+0 \) \
\( -clone 0 -crop 23x16+80+0 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+16+87 -background white -extent 23x16 \) \
...
-delete 0 -quality 100% thumb.jpg
我总是遇到以下错误:
montage.im6: geometry does not contain image `test.jpg' @ warning/transform.c/CropImage/574.
我尝试使用 "repage" 和 "page" 参数,但没有成功。
有什么想法吗?
更新
马克要求举例。所以我试着写下我想在一个步骤中合并的不同步骤:
convert logo: test.jpg
convert test.jpg -thumbnail "150x100>" -background white -gravity center -extent 150x100 -page 150x100+0+0 test.resized.jpg
montage -mode concatenate test.resized.jpg \
\( -clone 0 -crop 23x16+80+20 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+92+74 -background white -extent 23x16 \) \
\( -clone 0 -crop 23x16+100+80 -background white -extent 23x16 \) \
-delete 0 -quality 100% result.thumb.jpg
我必须承认这个让我迷惑了!我无法让它像你尝试的那样工作,或者我根本不想这样做。我发现只有添加 +repage
才能使它工作,但如果我这样做,它会 忘记 -extent
,所以我一直以 2 个命令结束.我还发现 +clone
拒绝在这个例子中代替 -clone 0
工作,这也让我很困惑。
唯一能让它工作并避免中间文件的方法是将第一个 convert
的输出流式传输到第二个。
convert logo: -resize "150x100>" -background white -gravity center -extent 150x100 JPG:- | \
convert JPG:- \
\( -clone 0 -crop 23x16+80+20 \) \
\( -clone 0 -crop 23x16+92+74 \) \
\( -clone 0 -crop 23x16+100+80 \) \
-delete 0 +append out.jpg