Maim, take screenshots from the Ubuntu terminal

about maim

In the next article we are going to take a look at Maim. This is a free and open source tool with which to take screenshots of our desktop. Maim allows many interesting functionalities, such as the possibility of taking screenshots of our desktop and saving them in png or jpg format, allowing us to take screenshots in predetermined regions or windows, or manually selecting a region or window before taking a screenshot. . This application seeks to overcome the deficiencies that scrot had.

Today, every desktop environment such as GNOME, KDE, or XFCE has its own built-in application specifically designed for the task of taking screenshots, but there are many other small programs that are independent of the desktop. In the following lines we are going to take a look at a very light and versatile command line application called maim (make image), and some of the options that we can use to modify its behavior.

General characteristics of maim

  • This program will allow us take screenshots of our desktop, and save them in png or jpg format.
  • In addition to take screenshots of the entire screen, we can also take screenshots of predetermined regions or windows.
  • We will be able set a delay of a few seconds before capturing.
  • It allows users select a region or window before taking the screenshot of screen.
  • It combines the system cursor with the screenshot, so you can take screenshots with cursor.
  • This program can mask the pixels outside the window, to make them transparent or black.
  • Maim cleanly pipes screenshots directly to standard output (unless otherwise specified), allowing command chaining.

Install maim on Ubuntu

This application is free and open source software, and the source code is available at GitHub. Maim is available from the default repositories of all the most used Gnu / Linux distributions. To install it on Debian and its derivatives, among which is Ubuntu, we only need to open a terminal (Ctrl + Alt + T) and execute the commands in it:

install maim

sudo apt update; sudo apt install maim

Once the application is installed on our system, we can start using it to take screenshots from the command line.

app version

Basic use

The maim utility is very easy to use, especially in its most basic use. If we are interested take a screenshot of the whole screen and save it to the file called ‘capture.png‘, all we have to do is open a terminal (Ctrl + Alt + T) and use maim as follows:

basic use

maim ~/captura.png

By default, the application will try to use the format in which the image will be saved based on the file name. This program supports png and jpg formats, the former being the default. It will also allow us the possibility to select the quality of the resulting image using the -m option, and express the compression level as an integer from 1 to 10. This will have different effects depending on the image format chosen.

Interactively select the region to capture

As I said lines above, when executing the previous command, all the content of the screen will be included in the screenshot, without the need for user interaction. But when we want select the regions of the screen to capture more precisely, we can run the application with the -s (–Select). This will run maim en ‘interactive mode‘:

interactive mode to select capture region

maim -s ~/captura

Once the above command is launched, the shape of the cursor will change to a ‘signmore‘and we can select the region to capture using the mouse.

Take a screenshot after a delay period

This application will also offer us the possibility of use a delay expressed in seconds before taking the screenshot. The option that allows us to do that is -d (which is short for –delay). As you can imagine, all we have to do is pass a number as an argument to the option. For example, if we want to wait 10 seconds before taking a screenshot, the command to use would be:


maim -d 10 ~/captura

Once the command is launched, a countdown will appear in the terminal. When finished, the screenshot will be saved to the specified location.

More options

In order to see all the options that this program can offer, in a terminal (Ctrl + Alt + T) we can use the command:

maim help

maim -h


In order to remove this program from our team, in a terminal (Ctrl + Alt + T) we will only need to execute the command:

uninstall maim

sudo apt remove maim

In Gnu / Linux we can find many utilities to take screenshots. In these lines we have seen that maim is one of them, and that this application can be used for the terminal in Gnu / Linux when the Xorg server is running. The possibilities that we have just seen are just some of the basic options, but the program offers much more. For more information about this project, users can consult your repository on GitHub.

Add Comment