Decimal rounding (?) makes XnView MP's search function miss certain aspect ratios
Posted: Tue Oct 29, 2024 2:50 pm
Ante-scriptum: Not sure if this should be reported as a bug, or perhaps a suggestion?
In XnView MP's search function, there is the choice to search by "ratio". Adding that condition presents a dropdown list with numerous common ratios: "1.00 (1:1)," "1.20 (12:10)," and so on.
I noticed however that when I search for 16:9 aspect ratio images, the search function does not pull up images cropped to the 16:9 aspect ratio in post-processing software (either RawTherapee or Affinity Photo in my case). It does however find images that came out of the camera as 16:9, that is, a number of my images taken with a cell phone.
I think this is a mathematical rounding issue. In the dropdown menu, the 16:9 ratio is presented as "1.78 (16:9)".
Very precisely, the 16:9 aspect ratio, converted to a decimal value, is 1.7777∞ (determined simply by converting the ratio to a fraction (16/9) then dividing the numerator by the denominator). So, XnView MP's rounding is correct: brought down to two digits after the decimal, this indeed becomes 1.78.
However, both of the programs I use for post-processing appear to be cropping to as close as they can get to that 1.7777∞.
For example, if I take an image measuring 5553 X 3702 pixels and crop it to 16:9 in either RawTherapee or Affinity Photo, the resulting image measures 5553 X 3124 pixels. Thus, 5553 divided by 3124 gives a decimal ratio of 1.7775288.
One more example: an image measuring 3919 X 2799 pixels and cropped to 16:9 gives an image measuring 3919 X 2205 pixels. Thus, 3919 divided by 2205 gives a decimal ratio of 1.7773242.
I cannot speak for any other post-processing software, but I do hope someone can confirm this in e.g., Lightroom, Photoshop, etc.
Neither of the above cropped images are found by a search for the condition "Ratio" set to "1.78 (16:9)".
EDIT: I did the calculations for a few images that the search does find, e.g.: 2592 X 1456 px, i.e. a decimal ratio of 1.7802197 // 859 X 482 px, i.e. a decimal ratio of 1.7821576 // 3264 X 1832 px, i.e. a decimal ratio of 1.7816593.
So, I'm wondering if it seems as if XnView MP is looking only for images with specifically a two-decimal ratio of 1.78 and thus missing all of those that are close to, but not exactly 1.78.
If indeed this is the case, is there a way to engineer into XnView MP a greater ability to detect 16:9 ratios that are close to but not exactly 1.78? Would it be possible to reset the parameter to read any decimal from, say, 1.777 to 1.787 as 16:9? Definitely, a better math mind than mine is needed!
Thanks in advance for any info you can give!
In XnView MP's search function, there is the choice to search by "ratio". Adding that condition presents a dropdown list with numerous common ratios: "1.00 (1:1)," "1.20 (12:10)," and so on.
I noticed however that when I search for 16:9 aspect ratio images, the search function does not pull up images cropped to the 16:9 aspect ratio in post-processing software (either RawTherapee or Affinity Photo in my case). It does however find images that came out of the camera as 16:9, that is, a number of my images taken with a cell phone.
I think this is a mathematical rounding issue. In the dropdown menu, the 16:9 ratio is presented as "1.78 (16:9)".
Very precisely, the 16:9 aspect ratio, converted to a decimal value, is 1.7777∞ (determined simply by converting the ratio to a fraction (16/9) then dividing the numerator by the denominator). So, XnView MP's rounding is correct: brought down to two digits after the decimal, this indeed becomes 1.78.
However, both of the programs I use for post-processing appear to be cropping to as close as they can get to that 1.7777∞.
For example, if I take an image measuring 5553 X 3702 pixels and crop it to 16:9 in either RawTherapee or Affinity Photo, the resulting image measures 5553 X 3124 pixels. Thus, 5553 divided by 3124 gives a decimal ratio of 1.7775288.
One more example: an image measuring 3919 X 2799 pixels and cropped to 16:9 gives an image measuring 3919 X 2205 pixels. Thus, 3919 divided by 2205 gives a decimal ratio of 1.7773242.
I cannot speak for any other post-processing software, but I do hope someone can confirm this in e.g., Lightroom, Photoshop, etc.
Neither of the above cropped images are found by a search for the condition "Ratio" set to "1.78 (16:9)".
EDIT: I did the calculations for a few images that the search does find, e.g.: 2592 X 1456 px, i.e. a decimal ratio of 1.7802197 // 859 X 482 px, i.e. a decimal ratio of 1.7821576 // 3264 X 1832 px, i.e. a decimal ratio of 1.7816593.
So, I'm wondering if it seems as if XnView MP is looking only for images with specifically a two-decimal ratio of 1.78 and thus missing all of those that are close to, but not exactly 1.78.
If indeed this is the case, is there a way to engineer into XnView MP a greater ability to detect 16:9 ratios that are close to but not exactly 1.78? Would it be possible to reset the parameter to read any decimal from, say, 1.777 to 1.787 as 16:9? Definitely, a better math mind than mine is needed!
Thanks in advance for any info you can give!