Hi All,
I have a set of Multi Page TIF image files, which I am trying to split into individual images. I have tried using convert, which does the trick, but does not give me an option to retain the original file name.
Example:
A.TIF - Original File (10 Pages)
I use :
Convert *.tif %d.tif
Output: 10 different images are created with the file names(0.tif, 1.tif,2.tif,3.tif, 4.tif,5.tif, 6.tif, 7.tif, 8.tif, 9.tif)
The above output would be perfect for me only if I could retain the original file name after conversion/splitting.
Desired output:
10 different images with filenames ( A_1.tif, A_2.tif, A_3.tif, A_4.tif, A_5.tif, A_6.tif, A_7.tif, A_8.tif, A_9.tif, A_10.if)
I have several multi page tif files that I would like to convert, and retain their original file names. I cannot type the filename everytime I run the command.
Here is a sample multi page tif file if required -- http://www.nightprogrammer.org/wp-uploa ... xample.tif
Any help on this is much appreciated.
Thanks in advance !!
PS: I have looked through the forums, googled a lot, tried Mogrify instead, but nothing seems to help.
- Mogrify is not able to split the files, rather it makes the same file 10 times larger.
Split multipage TIF,TIFF images into individual images and RETAIN original filename after conversion.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Split multipage TIF,TIFF images into individual images and RETAIN original filename after conversion.
Try this...
Code: Select all
convert A.tif -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif"
Re: Split multipage TIF,TIFF images into individual images and RETAIN original filename after conversion.
Hi GeeMack,
Thank you for your prompt response. The solution works really well for my requirement, with a minor issue.
The below code gives works well if I use A.tif in it.
What I tried:
I renamed the same file to A.tif, B.tif, C.tif and tried the above code; it gives me the following output.
A.tif : A_1.tif , A_2.tif, A_3.tif, A_4.tif, A_5.tif, A_6.tif, A_7.tif, A_8.tif, A_9.tif, A_10.tif
B.tif : B_11.tif , B_12.tif, B_13.tif, B_14.tif, B_15.tif, B_16.tif, B_17.tif, B_18.tif, B_19.tif, B_20.tif
C.tif : C_21.tif , C_22.tif, C_23.tif, C_24.tif, C_25.tif, C_26.tif, C_27.tif, C_28.tif, C_29.tif, C_30.tif
Is there a way to start the number increment from 1 for each file?
Example:
A.tif : A_1.tif , A_2.tif, A_3.tif, A_4.tif, A_5.tif, A_6.tif, A_7.tif, A_8.tif, A_9.tif, A_10.tif
B.tif : B_1.tif , B_2.tif, B_3.tif, B_4.tif, B_5.tif, B_6.tif, B_7.tif, B_8.tif, B_9.tif, B_10.tif
C.tif : C_1.tif , C_2.tif, C_3.tif, C_4.tif, C_5.tif, C_6.tif, C_7.tif, C_8.tif, C_9.tif, C_10.tif
Thank you in advance
Thank you for your prompt response. The solution works really well for my requirement, with a minor issue.
The below code gives works well if I use A.tif in it.
Code: Select all
convert A.tif -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif"
Code: Select all
convert *.tif -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif"
A.tif : A_1.tif , A_2.tif, A_3.tif, A_4.tif, A_5.tif, A_6.tif, A_7.tif, A_8.tif, A_9.tif, A_10.tif
B.tif : B_11.tif , B_12.tif, B_13.tif, B_14.tif, B_15.tif, B_16.tif, B_17.tif, B_18.tif, B_19.tif, B_20.tif
C.tif : C_21.tif , C_22.tif, C_23.tif, C_24.tif, C_25.tif, C_26.tif, C_27.tif, C_28.tif, C_29.tif, C_30.tif
Is there a way to start the number increment from 1 for each file?
Example:
A.tif : A_1.tif , A_2.tif, A_3.tif, A_4.tif, A_5.tif, A_6.tif, A_7.tif, A_8.tif, A_9.tif, A_10.tif
B.tif : B_1.tif , B_2.tif, B_3.tif, B_4.tif, B_5.tif, B_6.tif, B_7.tif, B_8.tif, B_9.tif, B_10.tif
C.tif : C_1.tif , C_2.tif, C_3.tif, C_4.tif, C_5.tif, C_6.tif, C_7.tif, C_8.tif, C_9.tif, C_10.tif
Thank you in advance
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Split multipage TIF,TIFF images into individual images and RETAIN original filename after conversion.
try adding -scene 0 after reading the *.tif, but I am not sure even that will work.
You may have to write a script loop over each image and run it as in your first case. If so the script loop will depend upon your OS. Please always provide your IM version and platform/OS.
You may have to write a script loop over each image and run it as in your first case. If so the script loop will depend upon your OS. Please always provide your IM version and platform/OS.
Code: Select all
convert Image.tif -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif"
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Split multipage TIF,TIFF images into individual images and RETAIN original filename after conversion.
fmw42 wrote: ↑2017-02-22T00:55:49-07:00 try adding -scene 0 after reading the *.tif, but I doubt even that will work.
You may have to write a script loop over each image and run it as in your first case. If so the script loop will depend upon your OS. Please always provide your IM version and platform/OS.
Code: Select all
convert Image.tif -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif"