import

graphicsLinux/Unix
The import command is one of the most frequently used commands in Linux/Unix-like operating systems. import Capture an X server screen and save the image to a file

Quick Reference

Command Name:

import

Category:

graphics

Platform:

Linux/Unix

Basic Usage:

import [options] [arguments]

Common Use Cases

    Syntax

    import [options] filename

    Options

    Option Description
    -window ID Capture a specific window by its ID (use 'root' for entire screen)
    -display host:display.screen Specify the X server display to connect to
    -frame Include window manager frame in the capture
    -border Include window border in the capture
    -crop geometry Crop the captured image (WxH+X+Y format)
    -delay seconds Wait specified seconds before capturing
    -pause seconds Pause specified seconds between screen capture and saving
    -quality value JPEG/PNG compression level (1-100, higher is better quality)
    -format format Specify image format (png, jpg, tiff, etc.)
    -resize geometry Resize the image (e.g., 1024x768, 50%)
    -comment string Add a comment to the image metadata
    -annotate degrees text Annotate the image with text
    -colors value Set the number of colors in the image
    -monochrome Convert image to black and white
    -silent Operate silently (no beeps or messages)
    -verbose Print detailed information about the image
    -help Print usage information

    Examples

    How to Use These Examples

    The examples below show common ways to use the import command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    Basic Examples:

    import screenshot.png
    Capture a portion of the screen (selected with mouse) and save to screenshot.png.
    import -window root screenshot.png
    Capture the entire screen/desktop and save to screenshot.png.

    Advanced Examples:

    import -window ID screenshot.png
    Capture a specific window by its X window ID.
    import -frame -window ID screenshot.png Capture a window including its frame/decorations. import -delay 5 screenshot.png Wait 5 seconds before capturing the screenshot. import -quality 90 screenshot.jpg Save the screenshot as JPEG with 90% quality. import -crop 300x200+10+10 screenshot.png Capture a 300x200 pixel area at position x=10, y=10. import -format png -quality 95 screenshot.png Specify format and quality explicitly. import -silent -window root screenshot.png Capture the entire screen without displaying any messages.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The import command is part of the ImageMagick suite of tools and is specifically designed for capturing screenshots on X Window System environments in Linux and Unix-like operating systems. It provides a flexible way to capture the entire screen, specific windows, or selected regions. Key features of import: 1. Flexible Capture Options: import can capture the entire screen, a specific window (identified by its X Window ID), or a user-selected region by clicking and dragging with the mouse. 2. Window Manager Integration: The command can include or exclude window decorations (frames, borders) in the captured image, providing flexibility for different documentation needs. 3. Image Format Support: As part of ImageMagick, import supports a wide range of image formats, including PNG, JPEG, TIFF, and many others, with the format typically determined by the filename extension. 4. Image Quality Control: For formats like JPEG, import allows setting the compression level to balance between image quality and file size. 5. Timing Controls: The -delay option allows scheduling a capture after a specified wait time, which is useful for setting up the screen before capture, while -pause provides a gap between capturing and saving. 6. Image Manipulation: import can apply basic transformations like cropping, resizing, and color adjustments directly during the capture process. 7. Metadata Addition: The command supports adding comments and annotations to the captured images, which can be useful for documentation purposes. import is particularly valuable in scenarios such as: - Creating documentation with precise screenshots - Automated screen capturing for monitoring or testing - Taking partial screenshots of specific application features - Capturing specific windows without manual cropping - Integrating screen captures into scripts and automated workflows While import is powerful on X Window System, it's important to note that it doesn't work on Wayland compositors (which are becoming more common in modern Linux distributions) without additional configuration. For Wayland environments, alternative tools like grim, slurp, or screenshot features built into desktop environments are often used instead. The import command is typically installed as part of the ImageMagick package, which is available in most Linux distribution repositories.

    Related Commands

    These commands are frequently used alongside import or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the import command works in different scenarios.

    $ import
    View All Commands