I have a multipage tif image containing 50 pages. I need to draw rectangles on page 4 and save the multipage tif in the same page order. I've attempted many things with not much success. -clone does it somewhat but I can't figure out how to get the image I drew the rectangle on back in the correct sequence. I've also attempted using *.tif[4] for example also with no success.
Any ideas?
Here are two examples of attempts with no success:
1. Outputs only single page of 50 page TIF
convert "C:\01000014333.tif[3]" -fill "rgba(0,0,0,1)" -draw "rectangle 678,848,957,894" "C:\01000014333x.tif"
2. Outputs correct number of pages but the page with rectanagle is placed at end of sequence
convert "C:\01000014333.tif" ( -clone 3 -fill "rgba(0,0,0,1)" -draw "rectangle 678,848,957,894" ) -delete 3 "C:\01000014333x.tif"
Draw rectangle on multipage TIF
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Draw rectangle on multipage TIF
Taking your second example:
You read the 50 images. Then you clone number 3, so you now have 51 images, with the new one at the end. Then you delete number 3 so, as you say, the new one is still at the end.
I would swap the new image with number 3 ("-swap -1,3"), then delete the last one ("+delete").
An alternative method would "-delete 3", then "-insert 3".
You read the 50 images. Then you clone number 3, so you now have 51 images, with the new one at the end. Then you delete number 3 so, as you say, the new one is still at the end.
I would swap the new image with number 3 ("-swap -1,3"), then delete the last one ("+delete").
Code: Select all
convert "C:\01000014333.tif" ( -clone 3 -fill "rgba(0,0,0,1)" -draw "rectangle 678,848,957,894" ) -swap -1,3 +delete "C:\01000014333x.tif"
snibgo's IM pages: im.snibgo.com
Re: Draw rectangle on multipage TIF
Perfect! Thank you very much!