0

I have a big big size image of dimensions 4000*4000. I want to carry out various operations on the image :

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

Thus creating a batch of 36+81+9+1 = 127

I am trying to do something like

         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

But this doesn't work the desired way and produces some 250 files. what is wrong here ? What is the best way to concatenate all these commands ?

Sahil Grover
  • 1,862
  • 4
  • 26
  • 57

1 Answers1

0

+delete deletes only the last image in the image sequence. You want -delete 0--1, which means delete images 0 through -1, where the negatively indexed -1 refers to the last image in the sequence.

To elaborate just a bit, each of those -crop commands creates several images, so you want to make sure that you delete all of them from the stack after writing them to disk. When working with a complex convert command line like this, a good way to see what is going on with your image stack(s) at any point is to insert a -write info:.

retroj
  • 717
  • 6
  • 13