Hi -
I need to convert a large number of images to standard format with the same name. IE, I have numerous files which all need to become:
* source.png
* header_logo.png
* 115x45.png
And so on. I'd like to be able to do these all at once and have them create their own folders by doing something like {Filename} Logos in the output folder name. It doesn't seem like this works, and that I need to put each file in its own folder and then run convert on them rather than being able to do it in a batch.
Is there any solution I'm missing?
Send batch converted files to different output folders?
Moderators: XnTriq, helmut, xnview
-
- Posts: 2
- Joined: Fri Mar 10, 2023 7:08 pm
-
- XnThusiast
- Posts: 3691
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Send batch converted files to different output folders?
Probably only possible with a simple NConvert command line utility script, if that is any help?
-
- XnThusiast
- Posts: 3691
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Send batch converted files to different output folders?
If you are still there, I have been giving your need some thought, and think that a very simple NConvert script (batch file .bat) is probably all that would be needed. If I understand your needs correctly a loop can be avoided, a useful simplification. I assume that you are using Windows?
This is my outline proof-of-concept code, just two lines:
Source PNG files are placed in a folder Input, and when run the code creates for each source file two new files, which are placed in a folder with the source file name within an Output folder.
The first line places a copy of each source file into a folder with the source file name in the folder Output.
The second line creates the logo file and places it in the same folder; conversion to greyscale is used here as a placeholder operation.
The attached ZIP contains Input and Output files at completion, when two source PNGs are loaded. Code details can be tweaked within limits.
Note that the '%' character is doubled in Windows code to escape the character. You would also need to add PNG compression terms.
This is my outline proof-of-concept code, just two lines:
Code: Select all
nconvert -o Output/%%/%%.png Input/*.png
nconvert -grey 256 -o Output/%%/%%_logo.png Input/*.png
The first line places a copy of each source file into a folder with the source file name in the folder Output.
The second line creates the logo file and places it in the same folder; conversion to greyscale is used here as a placeholder operation.
The attached ZIP contains Input and Output files at completion, when two source PNGs are loaded. Code details can be tweaked within limits.
Note that the '%' character is doubled in Windows code to escape the character. You would also need to add PNG compression terms.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2
- Joined: Fri Mar 10, 2023 7:08 pm
Re: Send batch converted files to different output folders?
Hi, thanks for your reply! I'm using mac, actually, and nconvert doesn't seem to be playing nicely there. I can give it another try, though. I'm not familiar with the scripts, but I do this on a regular enough basis that it feels worth learning to me.
-
- XnThusiast
- Posts: 3691
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Send batch converted files to different output folders?
I have just edited my post, please read it again!
Note that with the above two-line code without a loop, each source file is opened and then resaved, rather than copied. With PNG source files that will of course have no effect on image quality, but could slow processing of large image collections relative to code using a loop.
Note that with the above two-line code without a loop, each source file is opened and then resaved, rather than copied. With PNG source files that will of course have no effect on image quality, but could slow processing of large image collections relative to code using a loop.