Wednesday, January 5, 2022

[SOLVED] Pyscreenshot black screenshots in Fedora/Linux

Issue

I am trying to take a screenshot using pyscreenshot in Fedora/Linux

import pyscreenshot as ImageGrab

# fullscreen
im=ImageGrab.grab()

# to file
im.save('im.png')

However the im.png is just a black image. I have tried to execute the script using sudo but the im.png is still black


Solution

Thanks to furas I found out that the problem is a bug with Gnome Wayland. All the backends but for the gnome-screenshot are not compatible with Wayland, a fast solution to the problem is to boot using Gnome Xorg



Answered By - Karampistis Dimitrios