Convert image files to multiple outputs
Moderators: XnTriq, helmut, xnview
-
- Posts: 5
- Joined: Sat Mar 24, 2018 6:58 am
Convert image files to multiple outputs
Hello everyone, I am a new member of the forum and I have no knowledge of script writing... (sorry for that in advance...)
So, even though I am familiar to batch processing softwares (like irfanview, xnconvert, photoshop, bridge,lightroom, faststone, blah blah blah), I want to simplify my life by being able to convert a set of images located in a root directory with many subdirectories to many other formats.
For example, let's say I have a directory tree like this:
C:\Images
C:\Images\chris1\TIFF
C:\Images\chris2\TIFF
C:\Images\chris3\TIFF
etc...
All of the above "chris" folders have a subfolder named "TIFF", which contais tiff files.
I need one of xnconvert/xnview/nconvert to batch process at once these tiff folders and create the following: next to every TIFF folder, I want to create three folders named
HiRes (high resolution),
MidRes (medium resolution) and
Thumb (thumbnails).
In these folders,
the Hires will have the tiffs converted to jpeg 100% quality,
the midres will have the hires converted to jpeg 150 dpi with preserving the print size and qith quality 100%
the thumb will have the midres converted to jpeg 72 dpi with 280 pixels for the longest side.
For now, I am doing each batch one step at a time with preserving the folder structure, renaming the output folders "tiff" to"hires" etc. and finally I am merging the 4 root directories, in order for the subfolders to be placed next to each other.
The final directory tree looks like this:
C:\Images
C:\Images\chris1
C:\Images\chris1\TIFF
C:\Images\chris1\HiRes
C:\Images\chris1\MidRes
C:\Images\chris1\Thumb
C:\Images\chris2
C:\Images\chris2\TIFF
C:\Images\chris2\HiRes
C:\Images\chris2\MidRes
C:\Images\chris2\Thumb
C:\Images\chris3
C:\Images\chris3\TIFF
C:\Images\chris3\HiRes
C:\Images\chris3\MidRes
C:\Images\chris3\Thumb
It would be a life saver if the xnconvert Output tab could have multiple outputs. Save the master files into a first output, then the second output to a third, the third into a fourth etc..
Thank you in advance,
Christopher
So, even though I am familiar to batch processing softwares (like irfanview, xnconvert, photoshop, bridge,lightroom, faststone, blah blah blah), I want to simplify my life by being able to convert a set of images located in a root directory with many subdirectories to many other formats.
For example, let's say I have a directory tree like this:
C:\Images
C:\Images\chris1\TIFF
C:\Images\chris2\TIFF
C:\Images\chris3\TIFF
etc...
All of the above "chris" folders have a subfolder named "TIFF", which contais tiff files.
I need one of xnconvert/xnview/nconvert to batch process at once these tiff folders and create the following: next to every TIFF folder, I want to create three folders named
HiRes (high resolution),
MidRes (medium resolution) and
Thumb (thumbnails).
In these folders,
the Hires will have the tiffs converted to jpeg 100% quality,
the midres will have the hires converted to jpeg 150 dpi with preserving the print size and qith quality 100%
the thumb will have the midres converted to jpeg 72 dpi with 280 pixels for the longest side.
For now, I am doing each batch one step at a time with preserving the folder structure, renaming the output folders "tiff" to"hires" etc. and finally I am merging the 4 root directories, in order for the subfolders to be placed next to each other.
The final directory tree looks like this:
C:\Images
C:\Images\chris1
C:\Images\chris1\TIFF
C:\Images\chris1\HiRes
C:\Images\chris1\MidRes
C:\Images\chris1\Thumb
C:\Images\chris2
C:\Images\chris2\TIFF
C:\Images\chris2\HiRes
C:\Images\chris2\MidRes
C:\Images\chris2\Thumb
C:\Images\chris3
C:\Images\chris3\TIFF
C:\Images\chris3\HiRes
C:\Images\chris3\MidRes
C:\Images\chris3\Thumb
It would be a life saver if the xnconvert Output tab could have multiple outputs. Save the master files into a first output, then the second output to a third, the third into a fourth etc..
Thank you in advance,
Christopher
-
- Author of XnView
- Posts: 44926
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Convert image files to many outputs
Currently you can save script but not easier as you would like.
But it's not only more than 1 output tab, but actions too. Each actions list is different for the output... i don't know how to make a simple UIBatichris wrote: It would be a life saver if the xnconvert Output tab could have multiple outputs. Save the master files into a first output, then the second output to a third, the third into a fourth etc..
Pierre.
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to many outputs
You might be able to get a partial solution by using multiple instances of XnConvert [possible using the ZIP download, I'm not sure about the installed version] set up with the actions and outputs required for each step, successively...xnview wrote:Currently you can save script but not easier as you would like.But it's not only more than 1 output tab, but actions too. Each actions list is different for the output... i don't know how to make a simple UIBatichris wrote: It would be a life saver if the xnconvert Output tab could have multiple outputs. Save the master files into a first output, then the second output to a third, the third into a fourth etc..
Otherwise, a full solution would probably be possible as a batch file .bat that calls NConvert repeatedly, and if necessary uses 'DOS' to create any new folders that are required.
Edit:
Reading your post again, couldn't the HiRes, MidRes and Thumb images all be produced from the source images, that might be a simplification? It might also, in principle, produce slightly better quality images.
-
- Posts: 5
- Joined: Sat Mar 24, 2018 6:58 am
Re: Convert image files to many outputs
First of all, thank you so much for the immediate responce to my post.
And, also, congratulations for this incredible program. Especially having all the changes updated on the preview window is by far the difference with other programs.
With other programs (that are not multithreading) I have achieved running many instances simultaneously by copying the .exe file and renaming it with the suffix "_instance1", "_instance2".
However, this is not the solution to my issue. And that is because the Tiff files are 100mb each (color, uncompressed). So, by running the Tiff files 3 times for also creating the MidRes and the Thumbs is really a time consuming procedure and it will bottleneck the performance of my PC (which I need to be at 100% in order to scan 1000 Tiffs daily).
Just to make it clear, running 1000 MidRes into Thumbs takes 3 minutes. When running them from Tiffs it takes almost as much as the Tiff to HiRes conversion (Reading 100mb tiff files instead of 2mb MidRes jpgs).
The beginning of my problem is to output my conversions next to the Tiff folders. I don't know how to do it. By just typing "HiRes" in the "output folder" tab, the program creates a "HiRes" subfolder in every tiff folder. And the same goes with the other conversions. I repeat that even by advising me how to create the conversion folders next to the TIFF folder, gives me a great advantage. It is one line cross checked from my to do list every day.
I have searched many posts and I have seen guys combining nconvert with python using loops or others combining nconvert and imagemagick.
Changing the UI is for my issue is out of the question. I just mentioned that the possibility of having it would be the real "life saver" and the huge difference with all the other programs that are bragging about their easy to use functionality as far as batch procedures are concerned.
Perhaps it is possible by doing it with nconvert maybe. With the loops I have mentioned before.
Converting the Tiff into HiRes
Converting the HiRes into MidRes
Converting the MidRes into Thumb
In general, I repeat that my main concern is the possibility of having the created HiRes, MidRes, Thumb folders "fall" next to the Tiff folders. Not in them. The possibility of having the batch procedures being done at once in one command is something I have dreamed ever since I got my job. And that is because, in every project, we create different produced categories of files for thumbnails, medium resolution jpegs (or PDF) and 1:1 copy of the original "heavy" original file as jpg.
Once again, thank you so much in advance and sorry for my looooong posts!
Christopher
And, also, congratulations for this incredible program. Especially having all the changes updated on the preview window is by far the difference with other programs.
With other programs (that are not multithreading) I have achieved running many instances simultaneously by copying the .exe file and renaming it with the suffix "_instance1", "_instance2".
However, this is not the solution to my issue. And that is because the Tiff files are 100mb each (color, uncompressed). So, by running the Tiff files 3 times for also creating the MidRes and the Thumbs is really a time consuming procedure and it will bottleneck the performance of my PC (which I need to be at 100% in order to scan 1000 Tiffs daily).
Just to make it clear, running 1000 MidRes into Thumbs takes 3 minutes. When running them from Tiffs it takes almost as much as the Tiff to HiRes conversion (Reading 100mb tiff files instead of 2mb MidRes jpgs).
The beginning of my problem is to output my conversions next to the Tiff folders. I don't know how to do it. By just typing "HiRes" in the "output folder" tab, the program creates a "HiRes" subfolder in every tiff folder. And the same goes with the other conversions. I repeat that even by advising me how to create the conversion folders next to the TIFF folder, gives me a great advantage. It is one line cross checked from my to do list every day.
I have searched many posts and I have seen guys combining nconvert with python using loops or others combining nconvert and imagemagick.
Changing the UI is for my issue is out of the question. I just mentioned that the possibility of having it would be the real "life saver" and the huge difference with all the other programs that are bragging about their easy to use functionality as far as batch procedures are concerned.
Perhaps it is possible by doing it with nconvert maybe. With the loops I have mentioned before.
Converting the Tiff into HiRes
Converting the HiRes into MidRes
Converting the MidRes into Thumb
In general, I repeat that my main concern is the possibility of having the created HiRes, MidRes, Thumb folders "fall" next to the Tiff folders. Not in them. The possibility of having the batch procedures being done at once in one command is something I have dreamed ever since I got my job. And that is because, in every project, we create different produced categories of files for thumbnails, medium resolution jpegs (or PDF) and 1:1 copy of the original "heavy" original file as jpg.
Once again, thank you so much in advance and sorry for my looooong posts!
Christopher
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to many outputs
Some slight encouragement for my suggested NConvert + 'DOS' batch file approach above:
o I have established that NConvert will automatically create a new output folder when it doesn't already exist, which could usefully simplify the code required.
o I have also confirmed that NConvert will accept 'DOS' variables in path names, if that might be useful, I'm not sure.
I have a feeling that the overall problem might not be too difficult, although in practice things generally turn out to be at least a bit more complex than expected, and that someone with more experience than I have might be able to produce a solution without too much effort. It's an interesting problem, and I like a challenge, but I have to be very careful what I take on, and can't give any guarantee to go further myself due to the time it could take.
Provided NConvert can perform the conversions you require, which shouldn't be a problem if you are able to perform them using XnConvert, the problem might possibly be as simple as producing the code to required for one input folder such as chris1, which should be straightforward, and then putting a 'For' loop around it, although quite possibly it wouldn't be quite as simple. Sadly people with more experience rarely post on the forum for these kinds of problems.
o I have established that NConvert will automatically create a new output folder when it doesn't already exist, which could usefully simplify the code required.
o I have also confirmed that NConvert will accept 'DOS' variables in path names, if that might be useful, I'm not sure.
I have a feeling that the overall problem might not be too difficult, although in practice things generally turn out to be at least a bit more complex than expected, and that someone with more experience than I have might be able to produce a solution without too much effort. It's an interesting problem, and I like a challenge, but I have to be very careful what I take on, and can't give any guarantee to go further myself due to the time it could take.
Provided NConvert can perform the conversions you require, which shouldn't be a problem if you are able to perform them using XnConvert, the problem might possibly be as simple as producing the code to required for one input folder such as chris1, which should be straightforward, and then putting a 'For' loop around it, although quite possibly it wouldn't be quite as simple. Sadly people with more experience rarely post on the forum for these kinds of problems.
-
- Posts: 5
- Joined: Sat Mar 24, 2018 6:58 am
Re: Convert image files to many outputs
Even the time taken to give a reply is highly appreciated!! Thank you!!
However, as far as the subfolder issue can you give me a placeholder or something that I can use, so every time I convert files, the images get into a folder NEXT to the Tiff folder and not in it?
No matter what I try, the folders (HiRes etc.) are created inside the TIFF folder. I need them to be created next to it. Not in it.
Thanks!
However, as far as the subfolder issue can you give me a placeholder or something that I can use, so every time I convert files, the images get into a folder NEXT to the Tiff folder and not in it?
No matter what I try, the folders (HiRes etc.) are created inside the TIFF folder. I need them to be created next to it. Not in it.
Thanks!
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to many outputs
That should be easy for a single folder using an NConvert script, as the required output folders can be created where required automatically when the script is run: probably only three NConvert statements needed to create the three folders of processed output files next to the input TIFF folder. The detail would be in defining the overall paths, so that you could use the script conveniently even on a single input folder.Batichris wrote:However, as far as the subfolder issue can you give me a placeholder or something that I can use, so every time I convert files, the images get into a folder NEXT to the Tiff folder and not in it?
No matter what I try, the folders (HiRes etc.) are created inside the TIFF folder. I need them to be created next to it. Not in it.
Using XnConvert, I don't know if there is a way of creating the new folders required even for a single folder by using suitable entries on the Output tab, possibly but also quite possibly not.
Edit:
I've just done a quick test, of a simple situation, and if on the XnConvert Output tab the output is selected to Folder and the path set to a required output folder that doesn't exist, the folder with the processed files is created automatically as in NConvert... That as it stands would only allow you to process one set of files to one type of output but you should be able to place the output folder alongside the input TIFFs folder, as you are requesting. Possibly something that it might be possible to develop further, I don't know.
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to many outputs
Good news:
I have an elemental proof-of-concept script that it should be possible to develop to meet your needs...
I'll update depending on how much time I can spend on going further.
If you already have each of the required stages running in XnConvert, could you please export the code for each stage from the Actions tab and post it, either as text in the post [between code tags, if possible] or put the files in a ZIP attachment. Thanks.
I have an elemental proof-of-concept script that it should be possible to develop to meet your needs...
I'll update depending on how much time I can spend on going further.
If you already have each of the required stages running in XnConvert, could you please export the code for each stage from the Actions tab and post it, either as text in the post [between code tags, if possible] or put the files in a ZIP attachment. Thanks.
-
- Posts: 5
- Joined: Sat Mar 24, 2018 6:58 am
Re: Convert image files to many outputs
I will do it tomorrow, first thing in the morning!
Thank you so much much, cday!
Thank you so much much, cday!
-
- Posts: 5
- Joined: Sat Mar 24, 2018 6:58 am
Re: Convert image files to many outputs
So, I have attached the three templates in the zip file.
Reminder: What I need is:
1) The three folders to be generated next to the TIFF folders
2) The process to be like this: find the tiff folders, create the hires, midres, thumb folders. Start converting the tiffs (TIFF) to jpg (hires), the jpg (hires) to jpg (midres) and the jpg (midres) to jpg (thumb).
If the program creates the conversions of each image one at the time or it creates all the hires first and then it creates the midres from the hires etc., it doesn't matter.
No matter the outcome, thank you for your time!!!!!!
If you were in Athens, Greece, I would buy you a coffee!!!
Christopher
Reminder: What I need is:
1) The three folders to be generated next to the TIFF folders
2) The process to be like this: find the tiff folders, create the hires, midres, thumb folders. Start converting the tiffs (TIFF) to jpg (hires), the jpg (hires) to jpg (midres) and the jpg (midres) to jpg (thumb).
If the program creates the conversions of each image one at the time or it creates all the hires first and then it creates the midres from the hires etc., it doesn't matter.
No matter the outcome, thank you for your time!!!!!!
If you were in Athens, Greece, I would buy you a coffee!!!
Christopher
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to many outputs
Thanks for attaching the XnConvert actions batch files.
I have prepared a test TIFF file, just a 24-bit white canvas 1200 x 1000px with LZW compression, and run it through the batch file script I have developed. The output from the script is attached, could you please see if it has produced the output files you requested.
I sent you a PM a couple of day's ago suggesting that you send me an image to test, either one of your existing TIFF files or a representative image if you could create one easily, by any available means. I would rather not post my code until it has been confirmed as satisfactory, and a file you supplied would be the ultimate test.
I have prepared a test TIFF file, just a 24-bit white canvas 1200 x 1000px with LZW compression, and run it through the batch file script I have developed. The output from the script is attached, could you please see if it has produced the output files you requested.
I sent you a PM a couple of day's ago suggesting that you send me an image to test, either one of your existing TIFF files or a representative image if you could create one easily, by any available means. I would rather not post my code until it has been confirmed as satisfactory, and a file you supplied would be the ultimate test.
You do not have the required permissions to view the files attached to this post.
-
- Moderator & Librarian
- Posts: 6388
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: Convert image files to multiple outputs
XnTriq wrote: ↑Wed Jul 09, 2014 12:30 am
Similar requests (for future reference):
-
- XnThusiast
- Posts: 4187
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Convert image files to multiple outputs
This is the NConvert code I developed in response to the original poster's request. The script, saved as a batch file .bat, for each folder of source images named 'TIFF' in the folder 'Images' creates three versions of the images in that folder, HiRes, MidRes and Thumbs, each version placed in a sub-folder with the relevant name, in the folder.
The original poster specified that each successive version be produced from the previous version; successive versions could alternatively have been produced directly from the original source TIFF images.
I think that's about right, it is a while since I produced the code.
Code: Select all
FOR /D %%Y IN ("C:\X\Images\*") DO (
MD "%%Y\HiRes"
nconvert -out jpeg -q 100 -o "%%Y\HiRes\%%.jpg" "%%Y\TIFF\*.tif*"
MD "%%Y\MidRes"
nconvert -dpi 150 -ratio -rtype lanczos -resize 50%% 50%% -out jpeg -q 100 -o "%%Y\MidRes\%%.jpg" "%%Y\HiRes\*.jpg"
MD "%%Y\Thumbs"
nconvert -dpi 72 -ratio -rtype lanczos -resize longest 280 -out jpeg -q 100 -o "%%Y\Thumbs\%%.jpg" "%%Y\MidRes\*.jpg"
)
The original poster specified that each successive version be produced from the previous version; successive versions could alternatively have been produced directly from the original source TIFF images.
I think that's about right, it is a while since I produced the code.