Send batch converted files to different output folders?

XnConvert Multi Platform - Windows, MacOSX, Linux

Moderators: XnTriq, helmut, xnview

aerrin99
Posts: 2
Joined: Fri Mar 10, 2023 7:08 pm

Send batch converted files to different output folders?

Post by aerrin99 »

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?
cday
XnThusiast
Posts: 4003
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Send batch converted files to different output folders?

Post by cday »

Probably only possible with a simple NConvert command line utility script, if that is any help?
cday
XnThusiast
Posts: 4003
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Send batch converted files to different output folders?

Post by cday »

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:

Code: Select all

nconvert  -o Output/%%/%%.png Input/*.png
nconvert  -grey 256 -o Output/%%/%%_logo.png Input/*.png
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.

A.zip
You do not have the required permissions to view the files attached to this post.
aerrin99
Posts: 2
Joined: Fri Mar 10, 2023 7:08 pm

Re: Send batch converted files to different output folders?

Post by aerrin99 »

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.
cday
XnThusiast
Posts: 4003
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Send batch converted files to different output folders?

Post by cday »

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.