Request: Option to 'Convert only if specified file parameter condition is satisfied'

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

Moderators: XnTriq, xnview

Post Reply
cday
XnThusiast
Posts: 2088
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Request: Option to 'Convert only if specified file parameter condition is satisfied'

Post by cday » Wed Jul 24, 2019 5:21 pm

There are requests from time to time to be able to convert images only if a specified file parameter condition is satisfied, for example only if 'pixel height is greater than 720px' or only if 'filesize is greater than 1000kb'.

A recent thread Pull out image height requested a way to copy a specified image file parameter to a variable, which could then be used in a script. That could have general application, but would require familiarity with a scripting language.

Another possible solution might be to add a new NConvert option to convert an image only if a specified file parameter condition is satisfied; as access to file parameters is already available, that might not be difficult to implement. :D

Initial support might be for: height | width | filesize set to | greater than | less than .

So maybe something like:

Code: Select all

-convert height_px greater_than 720 

cday
XnThusiast
Posts: 2088
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Request: Option to 'Convert only if specified file parameter condition is satisfied'

Post by cday » Fri Jul 26, 2019 2:05 pm

If this option can be implemented the following notation, or parts of it, might possibly be clearer:

Code: Select all

-only height greater 720

Alternatively the number of arguments could be reduced by using:

Code: Select all

-only_greater height 720

I think this function could be quite useful... :D

Post Reply