import - Linux


The import command in Linux is a utility that captures some or all of an X server screen and saves the image to a file. It is part of the ImageMagick suite of tools, which are used for displaying, converting, and editing raster image and vector image files. The import command is particularly useful for taking screenshots of programs and window sessions, and it can serve as a powerful tool for creating documentation, troubleshooting issues, or sharing screen states in graphical environments.


The basic syntax of the import command is as follows:

import [options] output_file
  • output_file: This is the required argument where the name or path of the image file where the screenshot will be saved is specified.


Here are some of the most commonly used options in the import command:

  • -window id | name : Capture a specific window by its ID or name. Without this, import captures from the root window.
  • -screen : Capture the entire screen.
  • -silent : Suppresses beep and cursor changes during capture.
  • -pause seconds : Pauses for the specified number of seconds before taking the screenshot.
  • -frame : Include the window’s frame in the screenshot.
  • -resize geometry : Resize the image to the specified width and height after capturing it.
  • -crop geometry : Crop the image according to the provided geometry after capturing it.
  • -quality value : Sets the compression level for the image (for formats such as JPEG).
  • -delay value : Adds delay in milliseconds between each screenshot when taking multiple screenshots.
  • -verbose : Provides detailed information about the image capturing process.


  1. Capture the entire screen and save as a PNG file:

    import -window root screenshot.png
  2. Capture a specific window by name and save it as JPEG with high quality:

    import -window "Mozilla Firefox" -quality 100 firefox_window.jpg
  3. Capture a portion of the screen:

    import -crop 1024x768+100+200 partial_screenshot.png
  4. Delay the capture by 5 seconds and include the window frame:

    import -frame -pause 5 delayed_capture.png

Common Issues

  • Permission Errors: Users might encounter permission issues capturing screens in environments with restricted access. Running the command with sudo may be necessary.
  • Incorrect file types: Saving the screenshot in an unsupported file type can lead to errors. Ensure the specified file type is supported by ImageMagick.
  • Capturing the wrong window: Use the correct window ID or title, and verify it through utilities like xwininfo.


import can be combined with other commands for more complex tasks. For example, you can automate the process of taking periodic screenshots and then compressing the images:

while true; do
  import -window root "$(date +'%Y%m%d%H%M%S').png"
  sleep 300  # Delay for 5 minutes
done | gzip > screenshots.gz
  • convert: Part of the ImageMagick suite, used to convert image files between different formats.
  • display: Another ImageMagick tool used to display image files.

For further reading on import and related commands, the ImageMagick official documentation at ImageMagick’s website is an excellent resource.