Tutorial Take Screenshots with Alpha Transparency

Discussion in 'Help' started by Daydreamer, Sep 11, 2011.

  1. Daydreamer

    Joined:
    Jan 29, 2007
    Gender:
    Male
    Location:
    Los Angeles
    137
    When taking a screenshot of a window on your desktop, it may look unprofessional when that screenshot shows your blurred desktop background. Especially if those screenshots are taken for presentation purposes. In this tutorial I will show you how to take a screenshot with a transparent background. We will be using a tool written in Python called Abscapture, whose simple but unique functions are needed for the purposes of this tutorial. A download link at the bottom of this post contains everything you need to run the necessary components under Windows without having to install anything.

    [​IMG]

    I will be quoting the author of the Abscapture tool.

    This tool works by capturing 2 screenshots. The first screenshot is the object on a black background. The second screenshot is the same object on a white background. The application then merges the 2 images together using a simple algorithm, producing a alpha-blended version of it."

    It is based on an idea of... well, if you have 2 images, one on black and one on white. If color of a pixel in the first picture is equal to the second picture, then that pixel is fully opaque. If a pixel on the first picture is black, and another picture is white, then that pixel is fully transparent.


    This tool is meant to run on and with other programs on Linux, so if you are on Windows, you will have to change your desktop background to black and white, take the two screenshots, and run the screenshots through the application yourself.

    Okay, let's get started.

    Prepare your desktop, open the dialog that changes your desktop's background.

    [​IMG]

    Take a screenshot with a black background. It's preferable if you save your images in a lossless format.

    [​IMG]

    Then white. Make sure no elements within the window have changed since the first screenshot.

    [​IMG]

    Run your screenshots through ablend.py, the script that blends the two images together. Open console.bat after extracting it from the download link, and enter "bin\python ablend.py image_on_black.png image_on_white.png output.png" without quotes. Replace the image_on_*.pngs with the names of your screenshots.

    Your final image should look like the one below.

    [​IMG]

    Looks good! But not all is perfect, the elements that have changed between the two pictures have become transparent. Notice the text below the desktop icons, and the color swatch. I wouldn't try to use this on anything animated.

    But why go though all this trouble? Don't. There's already a great screenshot taking program for Windows called Shotty, that takes screenshots in the same way as Abscapture. Shotty's only downside is that it can't take transparent screenshots of the entire desktop. I have written this tutorial mainly to reference Abscapture, an invaluable tool. Using it only for screenshots would be a shame.


    Download it here.​