Hi
I'm running ImageMagick 6.8.9-6 Q16 on Windows from command line.
I have a multi-page tif file, which I'm trying to split every two (or another number) of pages into smaller multipage tif files. Is there a way I can do this, ideally in a single command?
Cheers
Partially-splitting a multipage tif file
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Partially-splitting a multipage tif file
You can select frames/pages/layers using the image.tif[1,3,5,7,9 ....] type syntax for say every other frame, where you have to list every other frame (the ... is not part of the syntax). Unfortunately, IM does not have an automatic skip option in this type of sequence, for which I think is a lacking feature and would be useful to have.
Frame numbers start with 0.
So what you need to do is write a loop to compute the frame numbers you want and store in a string. Then use that inside [ ... ].
See the section on selecting frame at http://www.imagemagick.org/script/comma ... hp#anatomy
Code: Select all
convert image.tiff[0,2,4,6,8,10,12,14,16] result.tif
So what you need to do is write a loop to compute the frame numbers you want and store in a string. Then use that inside [ ... ].
See the section on selecting frame at http://www.imagemagick.org/script/comma ... hp#anatomy
Re: Partially-splitting a multipage tif file
Thanks, it looks like I might be able to do what I need with a combination of splitting, merging, and a third-party script.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Partially-splitting a multipage tif file
A Windows BAT script to generate the even numbers:
Code: Select all
setlocal enabledelayedexpansion
set evens=
for /L %%n in (0,2,20) do set evens=!evens!,%%n
rem Remove leading comma.
set evens=%evens:~1%
echo %evens%
snibgo's IM pages: im.snibgo.com