LinuxCommandLibrary

import

Capture and save X server screen

TLDR

View documentation for the original command

$ tldr magick import
copy

SYNOPSIS

import [options] [filename]
If filename is not specified, the captured image is written to standard output. If no options specify a window or region, import allows interactive selection by clicking on a window or dragging a rectangle.

PARAMETERS

-window id_or_name
    Captures a specific window. id_or_name can be the window's numerical ID (e.g., 0x1234567), its name, or the special keyword root to capture the entire desktop.

-display host:display.screen
    Specifies the X server to connect to. This is typically used in environments where the X server is not on the local machine or when targeting a specific display.

-frame
    Includes the window manager frame (e.g., title bar, borders) when capturing a window. By default, the frame is excluded.

-silent
    Prevents the command from ringing the X bell when capturing, which can be useful in scripts.

-crop geometry
    Crops the captured image to the specified geometry. Geometry is typically in the format widthxheight+x+y, where x and y are optional offsets.

-quality value
    Sets the compression quality for image formats that support it (e.g., JPEG, MIFF, PNG). value is an integer from 1 (lowest quality, highest compression) to 100 (highest quality, lowest compression).

-screen
    Captures the entire screen, including virtual desktops if applicable. This is an alternative to using -window root.

-verbose
    Prints detailed information about the image capture process to standard error.

-version
    Displays the ImageMagick version number and build information.

-help
    Displays a concise list of command-line options and their descriptions.

DESCRIPTION

The import command is a powerful utility from the ImageMagick suite, designed to capture images from an X server. It allows users to take screenshots of the entire screen, a specific window (by ID, name, or interactive selection), or a defined rectangular region of the screen. The captured image can be saved in various popular image formats, such as PNG, JPEG, GIF, and more. import is particularly useful in scripting environments, automated workflows, or when a command-line tool is preferred over a graphical screenshot utility. It provides fine-grained control over the capture process, including options for cropping, resizing, and adjusting image quality before saving.

CAVEATS

The import command primarily relies on the X Window System. It may not function natively or effectively in environments exclusively running Wayland, unless Xwayland is in use. For Wayland, alternative screenshot utilities designed for that compositor are generally recommended. Additionally, as part of the ImageMagick suite, import must be installed separately from the core Linux system utilities.

INTERACTIVE CAPTURE

When import is invoked without -window or -crop options and without a specific filename to redirect standard output, it enters an interactive mode. In this mode, the mouse cursor changes, allowing the user to either click on a desired window to capture it, or click and drag to define a rectangular region of the screen to capture.

WAYLAND COMPATIBILITY

On Linux distributions using Wayland as their default display server, import (and other X-based screenshot tools) may not directly capture content. While Xwayland can bridge some functionality, native Wayland screenshot tools like grim (for raw Wayland compositors) or desktop environment specific tools (e.g., gnome-screenshot, spectacle) are generally more reliable and performant.

HISTORY

The import command is an integral part of ImageMagick, a free and open-source software suite for displaying, converting, and editing raster image files. ImageMagick was first released in 1990 by John Cristy at DuPont. Over the decades, import has remained a staple for command-line screen capturing in X11 environments, evolving with ImageMagick's continuous development. While its direct use might have decreased in modern Wayland-centric desktop environments, it remains a robust and flexible tool for X11 users and automated scripting tasks.

SEE ALSO

Copied to clipboard