Import - My screenshot utility

screenshot, imagemagick, import

When I see recomendations on screenshot applications for Linux it’s usually either scrot or maim. I’m sure there is nothing wrong with them and I have never had any issues with them. A while ago I realized that ImageMagick comes with the import command which has the ability to take screenshots of your screen aswell. Since ImageMagick is installed on all of my machines I see no reason to install an additional application for this.

Taking a screenshot

The command for take a simple screenshot is

import -window root screenshot.png

This will take a screenshot of the whole root window, which is your screen.

How I use it

I have a script that I have a keybinding to that opens a rofi menu with different options.

#!/bin/bash

# options to be displayed
option0="screen"
option1="area"
option2="window"

# options to be displyed
options="$option0\n$option1\n$option2\n$option3\n$option4"

selected="$(echo -e "$options" | rofi -lines 1 -dmenu -p "scrot")"
case $selected in
    "$option0")
		import -window root /hdd/pix/prtsc/"$(date +%Y-%m-%d-%T.png)" && notify-send 'Screenshot' 'Done';;
    "$option1")
		import /hdd/pix/prtsc/"$(date +%Y-%m-%d-%T.png)" && notify-send 'Screenshot' 'Done';;
    "$option2")
		import -window id /hdd/pix/prtsc/"$(date +%Y-%m-%d-%T.png)" && notify-send 'Screenshot' 'Done';;
esac
  1. The first one just takes a screenshot of my whole screen in .png format and set the date and time as filename. After that it sends me a notification with dunst that a screenshot is captured

    import -window root /hdd/pix/prtsc/$(date +%Y-%m-%d-%T.png) && notify-send 'Screenshot' 'Done';;
    
  2. In the second option it is almost the same, but without the -window root part. This makes it possible for us to choose which part of the screen we want to capture using the mouse

    import /hdd/pix/prtsc/$(date +%Y-%m-%d-%T.png) && notify-send 'Screenshot' 'Done';;
    
  3. And the last one is with -window id. With this option we can chose a specific window to capture, this also using the mouse

    import -window id /hdd/pix/prtsc/$(date +%Y-%m-%d-%T.png) && notify-send 'Screenshot' 'Done';;
    

I do recommend to read up on the options that’s available. There is a lot of options you can use if you look at ImageMagicks website or the man page.