Page 1 of 1

cli/Multipage TIFF: how do I move front/back image?

Posted: 2014-04-29T10:11:48-07:00
by dhartford
Hi all,
I found this forum post which was somewhat close, but not quite: http://www.multipole.org/discourse-serv ... =1&t=20342

I'm trying to take a variety of multipage tiff images and copy them to another location with this modification:

-move the first page to the end of each respective document

or

-move the last page to the beginning of each respective document

The page counts are variable, so haven't found a good approach to handle this in imagemagick...so asking! :-)

-Darren

Re: cli/Multipage TIFF: how do I move front/back image?

Posted: 2014-04-29T10:47:45-07:00
by fmw42
see -delete and -swap and -clone at
http://www.imagemagick.org/Usage/basics/#clone
http://www.imagemagick.org/Usage/basics/#delete
http://www.imagemagick.org/Usage/basics/#swap

so to move the first frame to the last you could do

Code: Select all

convert image.tiff -clone 0 -delete 0 newimage1.tiff
to swap the first and last images,

Code: Select all

convert image.tiff -swap 0,-1 newimage2.tiff
The -1 means the last image


To put the last image to the first, you can do

Code: Select all

convert test.tiff -reverse -clone 0 -delete 0 -reverse test3.tiff

Re: cli/Multipage TIFF: how do I move front/back image?

Posted: 2014-04-29T11:10:42-07:00
by dhartford
confirmed, thanks so much!!

-Darren

Re: cli/Multipage TIFF: how do I move front/back image?

Posted: 2014-04-29T13:27:35-07:00
by snibgo
An alternative method of moving the last image to the first:

Code: Select all

convert in.tiff -insert 0 out.tiff