Rotate Raspberry Pi screen image

I am using the server software on a raspberry pi 3 touch screen. It works great, however the screen is upside down. Can I rotate it anywhere in the settings? I can remount the screen, but don't really want to do that. Is it somewhere in the terminal application I can do this?

Thanks very much.


  • From image documentation:

    Rotate Display

    Depending on how you have mounted the display, you may need to rotate the screen. To do this, login and run

    sudo nano /boot/config.txt

    and search for a line

    # Rotate screen 180°

    A value of 0 is no rotation, 2 = 180°.

  • Any idea how to do this to the output of the pi camera to repetier-host on the pi using ffmpeg?  

  • Webcam settings have a rotation settings in printer settings.
  • That only fixed displaying in repetier but also needed the web ui oriented correct.  After going through the webcamd daemon I was pointed to /boot/octopi.txt which allowed me to add the correct mjpg switches.
  • How do I log in to execute the command on the touch screen?
  • You login over ssh in commandline:
    ssh pi@ipnumber
    Since windows 10 even windows has the command natively on board, otherwise use putty.
    Password is raspberry

  • Hi, if I have the screen connected by HDMI, how can I rotate the screen? :/
  • With latest buster os there are several solutions to set in /boot/config.txt

    # Flips the display using the LCD's inbuilt flip functionality. Rotation: 0 = normal, 1 = 90°, 2 = 180°, 3 = 270°
    # lcd_rotate=0
    # Rotate in gpu instead. 90 and 270° require extra memory!
    # display_hdmi_rotate=0
    # For legacy drivers, same as display_hdmi_rotate
    # display_lcd_rotate=0
    # Deprecated, for backward compatibility
    # display_rotate=0

    Which of them work depends on the display. display_hdmi_rotate should work on all since it is rotated on gpu already, but then you might also need to invert touch driver positions. Not sure if they change automatically.
  • The display_hdmi_rotate option does not appear :/
  • Just add it - in the example they are all commented out either. That is the list I will have predefined in next release as that were all settings I could find on pi foundation home page as possible options.
  • It doesn't work, the operating system is raspbian? How can I access the desktop? From settings you can
  • Yes we use the official raspbian lite with some extra configurations. But the image it self has no full featured desktop to save ram and cpu. If you need a extra program on display login via ssh and set
    export DISPLAY=:0

    and then call the program you want on desktop. It will then open in front of the chromium browser.

  • Okay thanks
  • edited October 2022
    I am having similar issues where this does not work. I need to rotate the Repetier screen (via HDMI from the Pi 3) 90 degrees. No matter what, the Repetier UI screen stays exactly the same zero rotation. I can't even rotate 180 degrees. Is there another setting I need to rotate Repetier UI?
    FYI - using the BTT HDMI5 display HDMI + USB
  • I see there are instructions on the new V30+ images to rotate. Unfortunately those instructions do not work either.
     Solution one is m our config tool, just go to 8 Run raspi-config  6 Interfaces Options  1 Legacy Camera an select the legacy solution.

    Unfortunately this menu is incorrect. Also - why I would go to the legacy camera settings seems unusual.

    The second solution provided also does not work:

    pi@RepetierServer:~ $ DISPLAY=:0 sudo -AE arandr

    (arandr:6579): Gdk-CRITICAL **: 10:54:46.141: gdk_atom_intern: assertion 'atom_name != NULL' failed

    (arandr:6579): Gdk-CRITICAL **: 10:54:46.142: gdk_atom_intern: assertion 'atom_name != NULL' failed

  • Your instructions are incorrect, or at least incorrectly/incompletely written. It would be nice to get the second solution to work. I was able to open your settings UI in an X-session (where the settings were locked) but never on the HDMI display, so the second solution appears still broken. I am a bit disappointed in how messy your documentation is on this. For the record, here's how you can get this working:

    Reverting to the legacy driver is possible:
    1. Run:
    sudo raspi-config
     6) Advanced Options
     A2) GL Driver
     G1) Legacy

    2. edit /boot/config.txt e.g.

    3. in order to get the touch-screen oriented properly, you need to edit

    Section "InputClass"
            Identifier "libinput touchscreen catchall"
            MatchIsTouchscreen "on"
            MatchDevicePath "/dev/input/event*"
    #if screen is rotated, you need to transform the touch-matrix as per the below:
    #90 degrees
    #       Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
    #180 degrees
    #       Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
    #270 degrees
            Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"

            Driver "libinput"

  • Selecting legacy webcam does the same selecting old video driver.

    I have added the transformation solution for touch screen in case someone else needs this. This mainly depends on rotation option. The hdmi rotate solution I used to pi display did not need that, but if display is rotated software side I guess it needs to do the same with input needing this.

Sign In or Register to comment.