feh icon indicating copy to clipboard operation
feh copied to clipboard

Option to display only landscape or portrait images

Open pclenahan opened this issue 7 years ago • 3 comments

Using feh as a photo viewer with a Raspberry Pi and LED screen mounted on a wall to automatically show photos. The screen is in portrait orientation and I'd like to have feh only show portrait layout photos on that screen (i.e. image width less than image height). Similarly, I'll have another Raspberry Pi + screen in landscape orientation and I want to use feh on that system to only show landscape pictures (i.e. image width greater or equal to image height).

Love feh for my project and this would be a great additional capability. For now, I am going to try and separate the images out into two folders.

pclenahan avatar Jan 22 '19 02:01 pclenahan

Hi!

This is already possible with some shell scripting:

feh -L '%w %h %f' | awk '{ if ($1 > $2) { print $0 } }' | cut -d ' ' -f 3- | feh -f -

This will display all landscape files. Change it to $1 < $2 for portrait.

derf avatar Feb 15 '19 19:02 derf

Hi! Thanks for looking at this and suggesting an approach. Unfortunately that approach is not practical for performance reasons. As I mentioned, I am using a Raspberry Pi - a RPi Zero W. So very limited performance. feh runs well in slideshow mode using:

feh -r -Z -F -z

This works well since feh selects one picture at a time - very good performance. Your idea makes sense but requires a complete pass through all the images first. I played around with your suggestion, breaking it down. As a test, I tried just this part:

feh - r -L '%w %h %f'

It took about 4 hours 34 minutes to run through my directory tree (about 14K files)! So with the suggested approach, it would take at least 4 hours 34 mins before the first image comes up (assuming the rest works and I don't hit some other performance issue - I did not try your full command line on the whole directory tree).

Obviously, if the ability to select landscape or portrait natively within feh would not run into this issue.

As an additional comment, depending on the target user for feh, a native approach is MUCH more approachable for those of us who are not as adept at scripting. So more usable for the casual user.

pclenahan avatar Feb 19 '19 20:02 pclenahan

Having landscape and portrait picture filtering build in into feh would be a great feature. Very useful for self made digital picture frames.

banibanani avatar Jun 12 '21 16:06 banibanani