Plasma secrets: Remove shadows in screenshots


Updated: November 15, 2017

Do you occasionally take screenshots in your Plasma desktop? You do? Well, then you may have noticed that the created images (PNG) come with a relatively large transparent border, which makes image manipulation somewhat quirky. Say you want to be able to make screenshots without any borders, like Gnome or such. What now?

In this tutorial, I will actually show you three or four different methods that can help you make your images prettier, easier to use, and without any need to handle the transparency. Follow me.

Screenshot shadow

What it looks like

If you've followed my reviews, you've noticed a whole bunch of screenshots with a relatively big, thick black frame. This is merely the artifact of manipulating images with a wide, transparent (alpha) border against the black background of an image processing application. Could be anything really, but ideally, you want screenshots without any borders, and even more importantly, without any shadows. They may be pretty, but they are not helpful for making elegant, compact screenshots.

Settings

With the background layer merged into the fore image; the transparent area around the window thus vanishes.

Screenshot shadow

And this is the original effect.

Solution

Now, we will devise several workarounds, all of which will make us take screenshots with minimal fuss and no surrounding area around the active windows, because that's the idea, right. You want only the window.

There is not built-in way in Plasma to do this. Spectacle, the screenshot tool is hardcoded to add the alpha border, in order not to interfere with the window drop shadow. This in turn is dictated by the desktop theme, and most of them do come with colorful extras. Worse yet, some of the themes, like Breeze, do not come as easily editable selection of CSS files, you actually need to hack code and compile fresh shared objects.

But recently, I've been enjoying this desktop more and more - Kubuntu Zesty has become my absolutely favorite, and that means I'm spending time figuring out nice, elegant ways to tweak and tame the difficult bits. Screenshots are one of the top offenders, and since I spend a lot of time reviewing software, collecting hundreds of them weekly, it makes sense to focus here.

Option 1: Breeze theme details

This won't fix it, but it will minimize the effect. You need to edit window decorations. For your active theme, click the little cogwheel sign in the left bottom corner and then edit the shadow settings.

Themes

Theme details

You can only reduce the size to 6px, so you cannot fully get away with it. Moreover, this also affects how your programs look and not just screenshots, so there's a possibly negative side effect to this, other than just having prettier screenshots - lower contrast, windows are more difficult to discern. Again, this is only a workaround, and an incomplete at that, but we're getting there.

Small shadow test

This is the best you can do; quite ugly and uneven.

Small shadow, details

The screenshots, as shown in GwenView, hence the dark gray background.

Option 2: GIMP

If you use this sweet image processing software, then you can also take screenshots with it. The concept is quite simple. Active windows, full desktop, delay, everything. And it will do the job without any alpha borders or shadows.

GIMP options

Taken in GIMP

Option 3: Disable compositing

You may want to do this if you're having trouble with KWin, if you want to speed up your desktop by turning desktop effects off, and similar. We talked about this in the past. The side effect is, no shadows, hence no alpha border in screenshots. You can clearly witness this if you run a Plasma desktop as a virtual machine. Or without compositing, also on physical hardware.

Compositor options

Option 4: Gnome screenshot

Wait, what? Well, yes. You can install the Gnome application and use it instead. It's quite nifty, and it works just as well as Spectacle. The program itself is called, aptly, gnome-screenshot. Coming to Stores near you. Or something.

If you try to run this program in the Plasma desktop, you may discover that it does not run. Try again from the command line, and you will see the following error, which may make you think of Wayland and whatnot:

gnome-screenshot
** Message: Unable to use GNOME Shell's builtin screenshot interface, resorting to fallback X11.

Worry not. The solution is simple. Execute the program thus:

gnome-screenshot --interactive

Pin to the task manager, and Bob's your uncle from now on. Example:

Gnome, no border, no shadows

Gnome, another example

Conclusion

Here we go, another Plasma secret nailed. Screenshots aren't usually something most people need on a daily basis, but for those who do review software, they represent an important piece in the overall arsenal. And here, like anything, you want choice. Shadows aren't bad, alpha and thick borders aren't bad, but there should be an option to toggle them on/off as needed.

Since that convenience does not currently exist, there are several workarounds. My least favorite is playing with the theme, as it yields partial results, and compositing can be fun on machines with enough juice to handle it in a stable way. GIMP then, but it's a biggish program, which is why using the Gnome screenshot programs makes most sense. It's a light, useful application, and it solves our problem. I hope you enjoyed this tutorial, see ya.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate