Beautiful Screenshots

This weekend I finally sat down and wrote a screenshot effect for KWin. This effect redirects the rendering of any window into an off-screen texture and saves the texture into the home directory. The advantage of this effect is that it is hooked into the normal rendering process and so we can also capture the shadow and the translucency to get beautiful screenshots. If we capture a transparent window it does not show the windows below but only the captured window with the alpha channel turned on correctly. See for example:

Translucent Konsole with Oxygen shadows

Of course the effect is not meant to replace KSnapshot. Instead I prepared a patch which allows KSnapshot to use this effect when the user selected window under mouse cursor. The screenshot shown above was captured with this change to KSnapshot. I hope I will be able to merge this change, soon 🙂

Powered by Blogilo

20 Replies to “Beautiful Screenshots”

  1. Perfect. Up until know I re-added shadows in GIMP to make screenshots look right again.

    Seeing as I have to write an application manual (lots of screenshots) pretty soon: Is this patch available somewhere to test?


    1. Yes the effect to just save a screenshot of active window is in trunk and the other patch lives in reviewboard.

  2. Yay, keeping the shadows looks great!

    I always take a screenshot using region and placing the window over another blank window to keep them, so yay for not having to use this hacky workaround 🙂

  3. We Rock, Just one last request, Martin in this particular case I think the unactive version of the shadow would be better….

    @IAnjo this is better as its with true alpha in the shadow area so you can really do some nifty tricks 😀

    1. You just have to screenshot inactive windows 🙂 Doing that programmatically is most likely impossible as it’s part of the decoration and not the effect

  4. Hey ! It gives me an idea : maybe using this code it would be easy generate an aurorae windeco from an existing window. You ‘just’ have to store the bitmaps with transparency as png embedded in the svg theme file. The dificult part would be to know where the boundaries are.

    Actually, I was thinking about a script to generate an aurorae theme from a dekorator theme. This would be possible. But the above idea would be more generic

    1. Using bitmaps in Aurorae is kind of stupid. Aurorae is for scalable graphics. If you want to use bitmaps, use dekorator.

  5. ps … i know my previous post is completly offtopic with your blog content 🙂 sorry

    yeah , it will be nice to screenshot an window properly

  6. Wow. It’s true! Kwin developers really *are* sexier and more awesome! 😉

    /me is hoping we’ll get the screen record plugin back some day (albeit recording to theora or suchlike). Still, this is a fab step forward. Thanks Martin!

      1. I’m probably just speaking nonsense, but can’t you just save the output of kwin to a raw video file in /tmp?

        So other apps (like recorditnow or kdenlive) can just use kwin’s screen record plugin to do the actual recording instead of recordmydesktop (if the plug in is on of curse) and encode it afterwards.
        Like the plugin you wrote for the beautiful screenshots.

        I probably wont use it ever, but details like this would make kde even better especially if we want to compete against mac os X.

        PS I’m really glad developers such as yourself contribute to KDE.

        and BTW Kwin is the best WM out there IMHO, congratulations

  7. Does anybody know how to obtain a screenshot as a vector graphic?

    There actually exists a way for Gnome and I think it is just awesome, especially if you want to use the snapshot for a digital publication. In my humble opinion, SVG support together with the method presented here would make KSnapshot an optimal utility.

Comments are closed.