Filter images by Ratio (Width:Height)

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

urt
Posts: 2
Joined: Fri Jan 25, 2019 3:42 am

Filter images by Ratio (Width:Height)

Post by urt »

Hi

Is it possible to filter in folder images with specific {RatioHW}
User avatar
helmut
Moderator
Posts: 8687
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Filter images by Ratio

Post by helmut »

No, there is no such thing in XnView MP 0.99.7 like filtering for specific image parameters like size or image ratio.

A possible workaround that you could apply for some few folders (but not many - because it would be too cumbersome):
1. Start XnView.
2. In XnView browser display details instead of thumbnails "View > View As > Details".
--> XnView will display all kinds of columns including "Ratio". (By right clicking on the heading you can control which columns are displayed and by dragging you can change the order of the columns.)
3. Sort by "Ratio"
4. Select all images that have the desired image ratio and either assign a tag, a rating, or colour tag.
5. Set the filter in browser (View > Filter by > ) to display only the image with assigned tag, rating, or colour tag (whatever you assigned in the previous step.)
zarlan
Posts: 86
Joined: Thu Apr 14, 2022 10:33 am

Re: Filter images by Ratio

Post by zarlan »

helmut wrote: Sat Apr 30, 2022 3:31 pm3. Sort by "Ratio"
No, that doesn't work.
Having tried the sorting option of "Ratio" (not in detailed view, but Thumbnails + Label, but the sorting order should still be the same), I can confirm that sorting by ratio, does NOT sort by the aspect ratio. (i.e. the ratio of width and height)
I have no idea what ratio it does sort by, but it certainly isn't the aspect ratio.

Edit: Huh? Now that I actually tried to sort by ratio, in detailed view (by clicking on the ratio column), it actually does seem to work. "Sort by"-"Ratio" still doesn't sort by ratio, but if I switch to detailed view, and click on the ratio column, it does sort by ratio. Very weird.
User avatar
helmut
Moderator
Posts: 8687
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Filter images by Ratio

Post by helmut »

Thank you for checking and your comment, zarlan. I've completely overseen that there is such a thing like file sorting using the menu "View > Sort by" which allows for sorting by ratio.

So the above workaround can be reduced to following steps:
1. Start XnView.
2. Sort images by ratio via menu "View > Sorty by > Ratio"
3. Select all images that have desired image ratio and either assign a tag, a rating, or colour tag.
4. Set the filter in browser (View > Filter by > ) to display only the image with assigned tag, rating, or colour tag (whatever you assigned in the previous step.)
zarlan wrote: Sun May 01, 2022 4:49 amEdit: Huh? Now that I actually tried to sort by ratio, in detailed view (by clicking on the ratio column), it actually does seem to work. "Sort by"-"Ratio" still doesn't sort by ratio, but if I switch to detailed view, and click on the ratio column, it does sort by ratio. Very weird.
I've just tried and compared the sorting of "View > Sort by > Ratio" and the sorting when clicking on "Ratio" column: Sorting is exactly the same and works without problem. At some stage I was irritated because some ratios are displayed as decimal value while other ratios (e.g. 1.33) are displayed as fraction (e.g. 3:4).
Could you, zarlan, please double-check whether ratio really doesn't sort properly?
zarlan
Posts: 86
Joined: Thu Apr 14, 2022 10:33 am

Re: Filter images by Ratio

Post by zarlan »

helmut wrote: Sun May 01, 2022 9:55 amAt some stage I was irritated because some ratios are displayed as decimal value while other ratios (e.g. 1.33) are displayed as fraction (e.g. 3:4).
I hadn't noticed, that the column does that.
Though it is mostly unavoidable/necessary, to use a decimal value (though being able to chose if it's w/h or h/w would be nice), being able to see common wallpaper ratios as 4:3, 5:4, 16:10, 16:9 etc, is quite good
…but mixing the two is a bit weird. (the wallpaper ratios should maybe be added after the decimal value, in parentheses, instead?)

But not as weird and bizarre, as the fact that XnView only appears to do it for 4:3 and 5:4, but not for the now far more common 16:10 and (the most common) 16:9. Nor as weird as the fact that those ratios are shown in reverse. For 4:3 images, the column displays the value "3:4", and 5:4 is presented as "4:5".
This makes absolutely no sense.
Could you, zarlan, please double-check whether ratio really doesn't sort properly?
Yep. It still doesn't sort according to ratio
…except, when I tried to check on my Linux computer, I found that it works there.
I use XnViewMP 0.99.7 64-bit, on both computers (Win7 64-bit on the Windows computer, on which ratio sorting doesn't work, and Xubuntu 18.04 64-bit, on the Linux one, where it does work)
User avatar
helmut
Moderator
Posts: 8687
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Filter images by Ratio (Width:Height)

Post by helmut »

Thanks for trying more and sharing your results here, zarlan.
  • Displaying some ratios as decimal value and some as fraction can really irritating. It is supposed to be either decimal values or fractions but a mixture. Perhaps solution is to display decimal value always and if fraction can be determined add it to the display value. E.g. for an image with 3266 x 2448 (width x height) in size it would display "1.33 (4:3)" as ratio.
  • In column "Ratio", when displaying fractions the image width and height are swapped - an image of 2448x3264 (width x height) in size displays 3:4 as image ratio while an image of 3264x2448 (width x height) displays 4:3. :bug:
  • From what I can see, XnView MP displays the ratio always as values larger than 1, i.e. ratio of larger side and smaller side. This might be o.k. and on purpose because you keep people from learning even more ratio values. Image ratio of 3:4 and 4:3 both result in a ratio of 1.33.
PS: Most likely, I'll split this topic and move the ratio stuff to forum "MP - Bug reports".
zarlan
Posts: 86
Joined: Thu Apr 14, 2022 10:33 am

Re: Filter images by Ratio (Width:Height)

Post by zarlan »

helmut wrote: Sun May 01, 2022 3:50 pm[*] From what I can see, XnView MP displays the ratio always as values larger than 1, i.e. ratio of larger side and smaller side. This might be o.k. and on purpose because you keep people from learning even more ratio values. Image ratio of 3:4 and 4:3 both result in a ratio of 1.33.
[/list]
There is a very big difference between an image that is, say, 16:9, and one that is 9:16. There may be cases, where it can be interesting to sort ratios in that manner, but those cases would be exceptions, rather than the norm. In most cases, it would be extremely undesirable, as it would lump images together, that shouldn't be anywhere near each other.

Oh, and just in case: I can safely say, that the problem with sorting by ratio, not actually sorting by ratio, on my Windows computer, has nothing to do with images being sorted in that way. I got, as an example, some images with a 16:9 ratio, followed by some images with other ratios, and then some more images with a 16:9 ratio.