0

NB: See bottom for actual question


There is an awesome screenshot utility for Windows called Shotty. It preserves translucency and drop shadow effects in screenshots. For example:

enter image description here

However, a screenshot from Ubuntu's built in utility does not preserve these effects, and looks pretty bad in comparison:

enter image description here

So, is there a screenshot utility for Ubuntu that will preserve the "eye-candy" like Shotty does?

  • 2
    Have you tried "shutter"? – Ravexina May 17 '17 at 19:33
  • @DavidFoerster Perhaps you should post that as an answer then – Android Dev May 27 '17 at 11:39
2

I don't think that's possible with the way display servers and window compositors interact in Linux (as opposed to Windows where the two are coupled much more tightly). However you can post-process the image to add a drop shadow similar to that added by the window compositor.

Find a suitable drop shadow filter

I found and played around a bit with ImageMagick’s -shadow filter and came close with these parameters:

convert :input.png \( +clone -background black -shadow 50x5+2+2 \) +swap -background none -layers merge +repage :output.png

As a bonus the shadow uses transparency for image formats like PNG (at 32 bit colour depth) that support it. Result from the example in your question:

screenshot with drop shadow

You can find a more in-depth explanation on the shadow filter in the Examples of ImageMagick Usage.

Combine the filter with a screenshot tool

We can write a small script to combine the above filter with a screenshot tool like gnome-screenshot:

#!/bin/bash
printf -v filename '%s/screenshot %(%F %T)T.png' "$HOME" -1
tmpfile="$(exec mktemp --tmpdir --suffix=.png screenshot.XXXXXXXXXX)"
trap 'rm -f -- "$tmpfile"' EXIT
gnome-screenshot "$@" -f "$tmpfile"
convert ":$tmpfile" \( +clone -background black -shadow 50x5+2+2 \) +swap -background none -layers merge +repage ":$filename"

…or use what’s already there

It appears the GNOME developers had a similar idea and integrated a shadow filter into their screenshot tool:

gnome-screenshot --window --border-effect=shadow

This creates almost the same visual effect as above:

You can unbind the default keyboard shortcut for screenshots and create an identical shortcut for a custom command like the one above.

For more info see gnome-screenshot(1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.