Screenshoots per Kommandozeile erstellen auf Linux System / Create screenshots via command line on Linux system (DE / EN)

in #linuxlast year (edited)

Screenshoots per Kommandozeile erstellen auf Linux System

(English Below / Englisch unten)

Die Wege auf einem Linux System Screenshots zu erstellen lassen sich grob in 3 Verschiedene Gruppen einteilen:

  1. Programme die das als Option anbieten (z.b Gimp) oder Ausdrücklich dafür gedacht sind. (z.b Shutter)
  2. Direkt ueber die jeweils eingesetzte Desktop Umgebung also sowas wie Gnome, KDE usw evtl auch Window Manager.
  3. Kommando Zeile/Textfenster

Die 3. Option hat den Vorteil das sie auf der grössten Anzahl von Systemen genutzt werden kann.

Bisher habe ich für die Kommando Zeile 2 Möglichkeiten gefunden.

scrot


in CMD ohne weitere Optionen ausgeführt erstellt es ein Bild vom kompletten Bildschirm und schreibt die Daten in eine png Datei.
Dabei wird auch der Bereich des Window Managers erfasst.

scrot --delay 10
Macht einen Screenshot mit 10 Sekunden verzoegerung

scrot --select
Der gewünschte Bereich des Bildschirms kann mit der Maus ausgewählt werden. (Fenster oder Rechteck)

import


import -window root x.jpg
Erfasst das komplette Root Window mit allen Subfenstern. Dabei werden allerdings nicht die Widgets des Window Managers erfasst. d.h dieser Teil des Bildschirms fehlt.

Wenn man einzelne Fenster auswählen will.

import -window 0x1a0000f x.jpg
import -window 27262991 x.jpg

Es gibt verschiedene Methoden die Nummern der einzelnen Fenster herauszubekommen. Teilweise ist das wieder spezifisch für die verwendete GUI bzw Window Manager.Bei mir funktioniert:

xwininfo

xwininfo wird auf Debian Systemen mit dem Packet x11-utils installiert.

Nach Eingabe von:
xwininfo
in einem Fenster erfolgt die Meldung das man bitte das gewnschte Fenster Anklicken solle. Nachdem das gemacht wurde tauchen in dem Fenster in dem xwininfo gestartet wurde neben anderen Informationen auch die Window ID des Fensters auf auf das geklickt wurde.


xwininfo -tree -root
gibt ausgehend vom root Window alle Fensternummern in Baumform aus.

Mit import ist es auch moeglich Screenshot Serien zu erstellen.
import -window root -snaps 10 -pause 10 snap.jpg
Die Bilder landen in diesem Beispiel in den Dateien snap-0.jpg, snap-1.jpg, snap-2.jpg ... snap-10.jpg.


English Version

Create screenshots via command line on Linux systems.

The ways to create screenshots on a Linux system can be roughly divided into 3 different groups:

  1. Programs that offer this as an option (e.g. Gimp) or are expressly intended for it. (e.g. shutter)
  2. Directly via the desktop environment, using something like Gnome, KDE, etc., Window Manager are also possible.
  3. Command line/text window

The 3rd option has the advantage that it can be used on the largest number of systems.

So far I have found 2 options for the command line.

scrot


executed in CMD without further options it creates an image of the whole screen and writes the data into a png file.
The area of the window manager is also included.

scrot --delay 10
Takes a screenshot with a 10 second delay

scrot --select
The desired area of the screen can be selected with the mouse. (window or rectangle)

import


import -window root x.jpg
Captures the complete root window with all subwindows. However, the widgets of the window manager are not included. i.e. this part of the screen is missing.

If you want to select individual windows you have to append the Number.

import -window 0x1a0000f x.jpg
import-window 27262991 x.jpg

There are several methods to get the numbers of the individual windows. In part, this is again specific to the GUI or window manager used. Works for me:

xwininfo

xwininfo is installed on Debian systems with the x11-utils package.

After entering:
xwininfo
A message appears in the window asking you to click on the desired window. After this has been done, the Window ID of the window that was clicked appears in the window in which xwininfo was started, along with other information.


xwininfo -tree -root
Outputs all window numbers in tree form starting from the root window.

With import it is also possible to create screenshot series.
import -window root -snaps 10 -pause 10 snap.jpg
In this example, the images end up in the files snap-0.jpg, snap-1.jpg, snap-2.jpg ... snap-10.jpg.

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.032
BTC 66101.68
ETH 3023.14
USDT 1.00
SBD 3.71