Page 1 of 1

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

Posted: Wed Jul 24, 2019 5:21 pm
by cday
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 

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

Posted: Fri Jul 26, 2019 2:05 pm
by cday
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

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

Posted: Tue Sep 03, 2019 3:51 pm
by xnview
will be added in next version

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

Posted: Wed Sep 04, 2019 11:44 am
by cday
xnview wrote:
Tue Sep 03, 2019 3:51 pm
will be added in next version
Thanks for including in NConvert 7.32... :D

Looks like a small typo in the help file:

Code: Select all

 -greater_than type value  : Process only if arg is less than value: Overwrite existing file
 -less_than type value     : Process only if arg is less than value
       type : height width filesize
First line less -> greater

And is 'Overwrite existing file' in the first line intended??

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

Posted: Wed Sep 04, 2019 4:37 pm
by cday
Continued...

Tested - six combinations - all work! :D

If possible, could the help file indicate that height and width are pixels [pretty obvious] and that the filesize parameter is *bytes* [less obvious but understandable].

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

Posted: Thu Sep 05, 2019 5:20 am
by xnview
cday wrote:
Wed Sep 04, 2019 4:37 pm
Continued...

Tested - six combinations - all work! :D

If possible, could the help file indicate that height and width are pixels [pretty obvious] and that the filesize parameter is *bytes* [less obvious but understandable].
ok :)