0

我有一个尺寸为4000 * 4000的大尺寸图像。我想进行的图像上的各种操作:如何有效连接ImageMagick并转换命令以生成图像no

convert a.jpg -crop [email protected] +repage +adjoin tile_6_%d.jpg 
convert a.jpg -crop [email protected] +repage +adjoin tile_9_%d.jpg 
convert a.jpg -crop [email protected] +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 [email protected] +repage +adjoin -write tile_6x6_%d.jpg +delete \) \ 
     \(+clone -resize 33% -crop [email protected] +repage +adjoin -write tile_3x3_%d.jpg +delete \) \ 
     \(+clone -crop [email protected] +repage +adjoin -write tile_9x9_%d.jpg +delete \) \ 
       -density 150 -quality 50  -resize 120x120  thumbnail.jpg 

但是,这并不正常工作所需并产生大约250个文件。这里有什么问题?连接所有这些命令的最佳方式是什么?

回答

0

+delete只删除图像序列中的最后一张图像。你想要-delete 0--1,这意味着删除图像0到-1,其中负索引-1指的是序列中的最后一幅图像。

为了详细阐述一下,这些-crop命令中的每一个命令都会创建多个映像,因此您要确保在将它们写入磁盘后将它们全部从堆栈中删除。当使用这种复杂的转换命令行时,在任何时候查看图像堆栈所发生的事情的一个好方法是插入一个-write info:

相关问题