Batch-convert single tiffs to multipage tiffs...

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

Post Reply
firestar
Posts: 1
Joined: Wed Jun 25, 2008 3:41 pm

Batch-convert single tiffs to multipage tiffs...

Post by firestar »

Hello,
I want to know how to batch-convert single tiffs from separate directories to multipage tiffs using xnview.

the directory structure is as follows:

dir1
subdir
|- img1.tiff
|- img2.tiff
|- img3.tiff

dir2
subdir
|- img1.tiff
|- img2.tiff
|- img3.tiff

I've got 1600 directories (dirs) to convert. What I want is that all tiffs in a directory are taken and converted into a multipage tiff named like the directory (dir1, dir2, etc..) then the next directory is processed, using batch-convert.

Q: Is this possible?
Q: Which program can do this job

Please respond, the job is really huge.

Thanks
User avatar
Peter2
XnThusiast
Posts: 1208
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Post by Peter2 »

Maybe you can you "nconvert" with a self-edited batch file?

Take one dir, make a "batch conversion", save it to "bat", take the batch as example for all other dirs and make a huge batch with all dirs.

Maybe ..??

Peter
XnView 2.49.3 German, Win 10
Guest

Post by Guest »

Hm, I will look into nconvert. I don't know yet if it has multipage TIFF options though. Problem is how to extract the directory names to paste into a batchfile quickly.

Peter, isn't there any other solution?
User avatar
Peter2
XnThusiast
Posts: 1208
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Post by Peter2 »

Anonymous wrote:Hm, I will look into nconvert. I don't know yet if it has multipage TIFF options though.
I think you are right :(
Anonymous wrote:.. Problem is how to extract the directory names to paste into a batchfile quickly...
With dir-commands, print to txt, and edit with excel and texteditor.
Anonymous wrote:...Peter, isn't there any other solution?
Sorry - no idea. Maybe with Adobe Professional or something like that?

Peter
XnView 2.49.3 German, Win 10
fritzxnview
Posts: 7
Joined: Sat Dec 23, 2006 6:31 pm

Post by fritzxnview »

I did a short test at commandline with nconvert and it worked

for /D %i in (*) do nconvert -multi -out tiff -o "%i.tif" "%i\*.tif"

in a batchfile it should written a bit different

for /D %%i in (*) do nconvert -multi -out tiff -o "%%i.tif" "%%i\*.tif"
firestar77

Post by firestar77 »

Hello fritzxnview,

thanks for the reply.

for /D %i in (*) do nconvert -multi -out tiff -o "%i.tif" "%i\*.tif"

doesn't quite work though: "%i\*.tif" isn't understood by nconvert.
(Error: Can't open file (15017025\Fich0001\*.tif))

When I use the image filename though it works for the images I've given.
eg. for /D %i in (*) do nconvert -multi -out tiff -o "%i.tif" "%i\Image1.tif" "%i\Image2.tif" "%i\Image3.tif" ...

is there a way to enable the wildcards like in your example? I'm using Windows 2000 SP4.

Regards,
firestar


P.S. Thanks for your response Peter, I'm using nconvert now :)
fritzxnview
Posts: 7
Joined: Sat Dec 23, 2006 6:31 pm

Post by fritzxnview »

Used nconvert 4.92, March 26 2008

could be, there is another error in nconvert

for /D %i in (*) do nconvert -multi -out tiff -o "%i.tif" %i\*.tif

this line should work at commandline
the quotation mark at last argument now lost

in general they should beware of white spaces, but why they don't work, i don't know

i did a short test with

dir 1
dir 2
dir3

Only dir3 was convertet.

And now the big point.

dir1 --> file 001, file 002 ... (with white spaces)
dir2 ...
dir3 ...

does work.

So the conclusion. At this time you can use it, if the last argument is without quotation marks and the folders are named without white spaces. The filenames can have them.

The same procedure with 4.95 and 4.98beta. Last argument is not proper handled with quotation marks.

Paris, we have a problem.
User avatar
xnview
Author of XnView
Posts: 33886
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

firestar77 wrote:Do you have tried
for /D %i in (*) do nconvert -multi -out tiff -o %i.tif %i\*.tif
And yes, if filename or folder have a space, there is a problem
Pierre.
firestar77

Post by firestar77 »

Thanks,
it works smoothly.

Pierre, it would be great if you could also implement the "whitespace" fix if you've got some free time on your hands. Just in case someone needs it (not so uncommon these days - dirs with whitespaces).

Regards,
Ben
Post Reply