Hi all,
I need to do this :
I have :
Folder_1 = 1.tiff, 2.tiff, 3.tiff
Folder_2 = 1.tiff, 2.tiff, 3.tiff
I want :
Folder_1 = 1.tiff multipage who include (1.tiff, 2.tiff, 3.tiff)
Folder_2 = 1.tiff multipage who include (1.tiff, 2.tiff, 3.tiff)
I want to do mass conversion on multiple folders at the same time, is it possible ?
Thx for help everyone
Tiff to multipage Tiff in distinct folder
Moderators: XnTriq, helmut, xnview
-
- XnThusiast
- Posts: 4115
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Tiff to multipage Tiff in distinct folder
Using NConvert on Windows?AurelSea63 wrote:I need to do this :
I have :
Folder_1 = 1.tiff, 2.tiff, 3.tiff
Folder_2 = 1.tiff, 2.tiff, 3.tiff
I want :
Folder_1 = 1.tiff multipage who include (1.tiff, 2.tiff, 3.tiff)
Folder_2 = 1.tiff multipage who include (1.tiff, 2.tiff, 3.tiff)
I want to do mass conversion on multiple folders at the same time, is it possible ?
If your need were limited to a small number of folders, one solution would be to use the following example code run in a batch file .bat:
Code: Select all
nconvert -multi -out tiff -o $$/Multi.tif Folder_1/*.tif
nconvert -multi -out tiff -o $$/Multi.tif Folder_2/*.tif
o I tested using the .tif extension rather than the equally valid as far as I know .tiff extension;
o The $$ notation saves entering the specific folder name, as a slight simplification.
o You will probably wish to insert a compression option after the -out tiff term above, please consult the help file for that.
o If your output multi-TIFF file uses the same filename as one of the input files there will be a conflict: a solution would be to delete the input single-TIFF files as they are read by inserting -D early in the code.
Always test using copies of your original files...
A more general solution probably requires a FOR loop I think: very few more experienced members post on NConvert topics, but I may have a look myself as I may have a generally similar need coming up.
-
- XnThusiast
- Posts: 4115
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Tiff to multipage Tiff in distinct folder
Further:
If you place your folders Folder_1, Folder_2 ... into a folder 'Process' the following code should perform the operation you requested:
Notes:
The -D term deletes the original single-image TIFFs after they have been processed, if you wish to retain them remove that term.
Select the TIFF extension used to suit your files.
The double quotes " " should enable filenames containing spaces to be processed.
The above code uses relative addressing as that is the way I work, if necessary use the full paths.
You still need to add suitable compression to the multi-page TIFFs created, the appropriate type depending on your needs.
Again, always test using copies of your original files...
E&OE: I don't pretend to understand the above code!
Edited:
Double quotes added to the 'for' line.
If you place your folders Folder_1, Folder_2 ... into a folder 'Process' the following code should perform the operation you requested:
Code: Select all
For /d %%Y in ("Process/*") do (
nconvert -D -multi -out tiff -o "Process/%%Y/Multi.tif" "Process/%%Y/*.tif"
)
The -D term deletes the original single-image TIFFs after they have been processed, if you wish to retain them remove that term.
Select the TIFF extension used to suit your files.
The double quotes " " should enable filenames containing spaces to be processed.
The above code uses relative addressing as that is the way I work, if necessary use the full paths.
You still need to add suitable compression to the multi-page TIFFs created, the appropriate type depending on your needs.
Again, always test using copies of your original files...
E&OE: I don't pretend to understand the above code!
Edited:
Double quotes added to the 'for' line.
-
- Posts: 2
- Joined: Tue Dec 26, 2017 10:37 am
Re: Tiff to multipage Tiff in distinct folder
Thx for help guys, i'm gonna try this now. I give u my feedback soon
-
- XnThusiast
- Posts: 4115
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Tiff to multipage Tiff in distinct folder
Important update:
The code that I posted above used forward slashes (/) in paths, and produced the desired result in my tests.
I was nonetheless in a general way aware that code run on the Windows command line should normally use back slashes (\) as path separators, although in practice either path separator can often be used. However, further research in relation to similar code that I need myself has indicated that when forward slashes are used code may not always run as expected.
This code I posted using forward slashes worked in my tests...
... but when backslashes are substituted the above code no longer runs, and the following notably different code is required:
That code is notably different and should I think be regarded as the more appropriate solution.
Anyone able to make a useful contribution please post...
The code that I posted above used forward slashes (/) in paths, and produced the desired result in my tests.
I was nonetheless in a general way aware that code run on the Windows command line should normally use back slashes (\) as path separators, although in practice either path separator can often be used. However, further research in relation to similar code that I need myself has indicated that when forward slashes are used code may not always run as expected.
This code I posted using forward slashes worked in my tests...
Code: Select all
For /d %%Y in ("Process/*") do (
nconvert -multi -out tiff -o "Process/%%Y/Multi.tif" "Process/%%Y/*.tif"
)
Code: Select all
For /d %%Y in ("Process\*") do (
nconvert -multi -out tiff -o "%%Y\Multi.tif" "%%Y\*.tif"
)
Anyone able to make a useful contribution please post...