INTERACT FORUM

More => Old Versions => JRiver Media Center 27 for Windows => Topic started by: mvandyke on March 13, 2021, 08:30:34 am

Title: Expression Help - Comparing two fields with math functions
Post by: mvandyke on March 13, 2021, 08:30:34 am
I want to be able to compare two fields [image height] and [image width] provide a numeric value from the two fields

For example , create add an expression column that creates a number based on image height divided by image width.  Example image height = 2000 and image width = 1000 would provide a number of 2.

I would like this so that I can see what images are portrait based that should be landscape based.  I have tons of images and this formula would help me sort those files and then rotate those images.

I've tried the math function, straight divide function and not getting the results that I need.

Thanks
Matt
Title: Re: Expression Help - Comparing two fields with math functions
Post by: zybex on March 13, 2021, 09:52:19 am
Did you remember to escape the fwd-slash?
Code: [Select]
Math([Width]//[Height])
You can use something like this to output a Landscape/Portrait/Square:
Code: [Select]
if(isequal([width],[height]), square, ifcase(Math([width]//[height]), 4, 0.8, portrait, 1.2, squarish, 1000, landscape))
Also, there's already an [Aspect Ratio] field, maybe you can use that.

edit: no need to use save()
Title: Re: Expression Help - Comparing two fields with math functions
Post by: mvandyke on March 13, 2021, 10:18:25 am
Did you remember to escape the fwd-slash?
Code: [Select]
Math([Width]//[Height])
You can use something like this to output a Landscape/Portrait/Square:
Code: [Select]
save(Math([width]//[height]),ratio)if(isequal([width],[height]), square, ifcase([ratio],4, 0.8, portrait, 1.2, squarish, 1000, landscape))

Also, there's already an [Aspect Ratio] field, maybe you can use that.

That was it -  the //

Thanks much Zybex appreciate the help and will explore the other options that you provided.