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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dhartford
Posts: 2
Joined: 2014-04-29T10:07:39-07:00
Authentication code: 6789

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
dhartford
Posts: 2
Joined: 2014-04-29T10:07:39-07:00
Authentication code: 6789

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

Post by dhartford »

confirmed, thanks so much!!

-Darren
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo »

An alternative method of moving the last image to the first:

Code: Select all

convert in.tiff -insert 0 out.tiff
snibgo's IM pages: im.snibgo.com
Post Reply