Open michaelpaar opened 2 months ago
I get this question quite often these days.
The old instruction set doesn't seem to do anymore: https://www.thedigitalpictureframe.com/raspberry-pi-digital-picture-frame-portrait-orientation/
Any thoughts on how to achieve this with Bookworm?
Now that we have solved Bookworm + Wayland, does Portrait mode work again?
Now that we have solved Bookworm + Wayland, does Portrait mode work again?
Sadly no, @sapnho - I just came here to try and find a solution. I followed the directions at the link you posted above, but of course that doesn't work as you noted. I have yet to find an actual solution.
I'm running a Pi 4 with the latest and updated Bookworm Lite OS and latest picframe.
One thing of note is that xrandr -q
displays XWAYLAND0
instead of HDMI-1
- I did try to insert that into run_start.py script but it had no effect:
from picframe import start
import os
os.system("DISPLAY=:0 xrandr --output XWAYLAND0 --rotate left")
start.main()
With the latest setup we use wlr-randr
(for turning screen on and off) which should allow --mode
and --transform
arguments. See https://manpages.debian.org/testing/wlr-randr/wlr-randr.1.en.html
What happens if you run that on the command line while picframe is running?
PS something like
wlr-randr --output HDMI-A-1 --mode 1080x1920 --transform 270
What happens if you run that on the command line while picframe is running?
Closer! So, when I run the following command (my display is 2560x1440) it does rotate the display:
wlr-randr --output HDMI-A-1 --mode 2560x1440 --transform 270
One thing to note is in your example you swapped the resolution values in the --mode
option which wlr-randr
does not respect, noting that it's an unsupported mode. It seems you only need the --transform
part....
However... It doesn't quite actually work. I did this initially while picframe
was running and the display rotated but picframe
didn't get the message and the images looked all stretched.
So, I tried adding the command above to the run_start.py
file just like in @sapnho 's original article and that did nothing. Both after restarting the picframe
service as well as after a full reboot.
@adammhaile I'm away at the moment so can't check up on this properly, but I seem to remember that I put a couple of variables into the configuration.yaml
file to force the correct dimensions on rotated screens. Try setting display_w
and display_h
, see what that does.
Paddy
@paddywwoof Closer still!
So, if I set:
display_w=1440
display_h=2560
It does work but only if I run the following command AFTER the picframe
service has started:
wlr-randr --output HDMI-A-1 --mode 2560x1440 --transform 270
It does nothing still when it's in run_start.py
I'm not familiar enough with the code to know where/how to make it run that command after the fact...
In the meantime, I added an option to rotate images on load, which should solve the problem at least for my specific needs:
Adam, that's a tidy solution to your problem. It might be even easier, and save adding niche code to picframe, to write a five line python script to just rotate images and save them as a one-off job after copying them to the raspberry pi.
I will look into the issue of when wlr-randr should be run to rotate the screen, once I'm home.
Paddy
write a five line python script to just rotate images and save them as a one-off job after copying them to the raspberry pi
I did consider it... probably what I'll actually end up doing. But I was curious how the code worked and thought maybe it might be generally useful beyond my use case.
Yes definitely worth putting up anything that solves a problem for you as it could well help someone else down the line.
I'll test it all out when I'm home but I think I would try putting the wlr-randr line at the end of start_picframe.sh
possibly after a pause to let picframe settle. Probably leave run_start.py
unchanged.
@paddywwoof that was it!
With the following set in configuration.yml
:
display_w: 1440
display_h: 2560
And the following start_picframe.sh
:
#!/bin/bash
source /home/admin/venv_picframe/bin/activate # activate phyton virtual env
picframe & #start picframe
sleep 5
wlr-randr --output HDMI-A-1 --mode 2560x1440 --transform 270
It works great. The sleep might be too long, but 5 works fine so I guess I'll leave it. Thanks so much for the help!
helgerbe,
Is it possible to invoke portrait mode using Bookworm and a pi4?
Regards, mike