Performance 如何高效地连接ImageMagick和convert命令以生成大量图像

Performance 如何高效地连接ImageMagick和convert命令以生成大量图像,performance,imagemagick,image-manipulation,imagemagick-convert,Performance,Imagemagick,Image Manipulation,Imagemagick Convert,我有一张尺寸为4000*4000的大图像。我想对图像执行各种操作: convert a.jpg -crop 6x6@ +repage +adjoin tile_6_%d.jpg convert a.jpg -crop 9x9@ +repage +adjoin tile_9_%d.jpg convert a.jpg -crop 3x3@ +repage +adjoin tile_3_%d.jpg convert a.jpg -resize 120x120 thumbnail.jpg 从而创建

我有一张尺寸为4000*4000的大图像。我想对图像执行各种操作:

convert a.jpg -crop 6x6@ +repage +adjoin tile_6_%d.jpg
convert a.jpg -crop 9x9@ +repage +adjoin tile_9_%d.jpg
convert a.jpg -crop 3x3@ +repage +adjoin tile_3_%d.jpg

convert a.jpg -resize 120x120  thumbnail.jpg
从而创建了一批
36+81+9+1=127

我正在尝试做一些类似的事情

         convert a.jpg \
      \( +clone -resize 66% -crop 6x6@ +repage +adjoin -write tile_6x6_%d.jpg +delete \) \
      \( +clone -resize 33% -crop 3x3@ +repage +adjoin -write tile_3x3_%d.jpg +delete \) \
      \( +clone -crop 9x9@ +repage +adjoin -write tile_9x9_%d.jpg +delete \) \
                -density 150 -quality 50     -resize 120x120      thumbnail.jpg

但这并没有达到预期的效果,产生了大约250个文件。这里怎么了?连接所有这些命令的最佳方法是什么?

+delete
仅删除图像序列中的最后一个图像。您需要
-delete 0--1
,这意味着删除图像0到-1,其中负索引的-1表示序列中的最后一个图像

更详细地说,这些
-crop
命令中的每一个都会创建几个图像,因此您需要确保在将它们写入磁盘后将它们从堆栈中全部删除。使用这样复杂的convert命令行时,要查看图像堆栈在任何时候的情况,最好插入一个
-write info: