When we take screenshots of selected areas on Ubuntu
(using Shift+Prt Scr or Ctrl+Shift+Prt Scr) we always select a rectangular area. So, I know I could just edit the image on some software like Inkscape to create a circle with the rectangular image, but I'd like to know if there's a configuration I can change for being able to select different kinds of shapes (mainly circles) directly when I'm taking the screenshot.
Is it possible?
Best Answer
I put together a small script for circular screenshots, you need the following packages (though it’s adaptable for other screenshot programs and terminal emulators as well):
The script
Save it as e.g.
~/circular_screenshot.bash
and make it executable withchmod +x ~/circular_screenshot.bash
. When you run it, the script first asks you to move the mouse cursor to the center position and press Enter and then to move it to an edge position (doesn’t matter which, the script calculates the radius from the distance) and again press Enter. The screen then flickers while the screenshot is taken (I recommend usingscrot $temp_screenshot
instead, it doesn’t show this odd behaviour.) and ImageMagick’sconvert
1 is used to crop the image. The output is saved with a timestamp as the filename in your home directory, you can change this behaviour by editing theoutput
variable of the script.Example output
Call without (or better: with an invisible) terminal window
I suppose you don’t want to have a terminal blocking your screen every time you make a screenshot like that, so here’s a solution for that; Call the script as follows (assuming the script was saved as
~/circular_screenshot.bash
):This runs the script in an invisible terminal window (icon with a red “X” and a blue “T”), you just need to make sure it’s focused when you type Enter. You can assign this command to a keyboard shortcut using your desktop environment’s settings.
As ImageMagick is incredibly powerful you can adapt this script to output other shapes as well, I used
ellipse
with the same radius in both x and y direction to draw the circle above – change that to e.g.$radius,$(bc <<<"$radius*0.5")
to get an ellipse with eccentricity above 0 instead.1: I took the approach from this thread on imagemagick.org.