LinuxCommandLibrary

magick-import

Capture an X server screen into an image

TLDR

Capture the entire X server screen into a PostScript file

$ magick import -window root [path/to/output.ps]
copy

Capture contents of a remote X server screen into a PNG image
$ magick import -window root -display [remote_host]:[screen].[display] [path/to/output.png]
copy

Capture a specific window given its ID as displayed by xwininfo into a JPEG image
$ magick import -window [window_id] [path/to/output.jpg]
copy

SYNOPSIS

magick-import [options] [filename]

Examples:
magick-import screenshot.png
(Interactively select a window/region by clicking or dragging)
magick-import -window root full_screen.jpg
(Capture the entire screen)
magick-import -window ID my_app.gif
(Capture a specific window by its ID)

PARAMETERS

-window
    Specify the ID or name of the window to capture. If not specified, the command typically enters an interactive mode for selection.

-frame
    Include the window manager frame and decorations in the captured image.

-silent
    Suppress the bell signal that typically sounds upon successful completion or failure.

-display
    Specify the X server display to connect to (e.g., :0.0 for local display).

-delay
    Pause for the specified number of milliseconds before capturing the image, useful for capturing transient states.

-quality
    Set the compression quality for image formats like JPEG (0-100). Higher values mean better quality but larger file size.

-crop
    Crop the captured image to the specified geometry (e.g., 800x600+10+20).

-resize
    Resize the captured image after capture to the specified dimensions (e.g., 50% or 1024x768!).

-monitor
    Monitor the progress of the image capture process.

-verbose
    Print detailed information about the image processing steps to standard error.

-help
    Display a summary of command options.

-version
    Print the ImageMagick version and exit.

filename
    The path and name for the output image file. The format is determined by the file extension (e.g., .png, .jpg, .gif).

DESCRIPTION

The magick-import command, part of the ImageMagick suite, is a powerful command-line utility designed for capturing images from an X Window System display. It allows users to capture the entire screen, a specific window by ID or name, or an interactively selected region of the screen. This tool is invaluable for creating screenshots, generating visual documentation, or automating screen capture processes within shell scripts. It supports saving captured images in various formats, leveraging ImageMagick's extensive format capabilities. magick-import is the modern successor to the older import command, providing robust and flexible screen grabbing functionalities on X-based environments.

CAVEATS

The magick-import command is designed primarily for the X Window System. It may not function directly or optimally in environments using modern display protocols like Wayland without the presence of XWayland or compatibility layers. Users might need to install additional X utilities (e.g., xhost) for certain remote display configurations. It is the current standard for screen capture within ImageMagick; the older import command is largely deprecated.

INTERACTIVE SELECTION

When magick-import is invoked without specifying a window ID or name (e.g., just magick-import output.png), the cursor will change to a cross-hair. You can then click and drag a rectangle to select a region, or simply click on a window to capture it. Pressing Shift + Click on a window will capture the window without its frame.

X WINDOW SYSTEM REQUIREMENT

This command relies heavily on the X Window System infrastructure. Functionality may be limited or unavailable on systems primarily using other display servers (like Wayland), unless an X compatibility layer (XWayland) is active. Ensure your DISPLAY environment variable is correctly set if you are running it remotely.

HISTORY

The ImageMagick project, initiated in 1987, has long included a screen capture utility. Initially known simply as import, this command provided the core functionality for capturing X window displays. With the significant overhaul in ImageMagick 7, which introduced the unified magick command-line tool, individual commands like import were rebranded with the magick- prefix, becoming magick-import. This evolution aimed to consolidate and streamline the ImageMagick toolset while maintaining backward compatibility for existing scripts and workflows. Its fundamental usage and purpose have remained consistent throughout its development.

SEE ALSO

magick(1), display(1), convert(1), scrot(1), xwd(1), grim(1), gnome-screenshot(1)

Copied to clipboard