Skip to main content

Background Transparency for PNG Output via Render Tool

If you choose a temporary PNG or a specific output of a type of PNG in the Render tool, there are extra options displayed in the tool's Configuration panel (under PNG Options). One of these options is Background. This option allows you to set a background color for the PNG.

You might also notice that there is a Transparent check box associated with this property. If you check this, then the color that you choose is set in the output PNG as a transparent color (for any viewing applications that honor a transparent color). In these applications, any pixels in the PNG that are that color, are transparent. This allows any background to show through.

For example, if you choose a transparent background color of “Magenta”, and open the output PNG in the Windows Photo Viewer (which honors transparent colors), the background is the window background color (usually white). If you view the same PNG in Microsoft Paint (which does not honor transparency), the background is magenta.

Note that the behavior of using a transparent color is different than using a simple mask (which marks that a pixel is either "in" or "out" of the transparent part of the image, regardless of the color of the pixel), or a mask which contains percentages of opacity, allowing transparent parts of the PNG to blend with whatever color makes up the background on top of which the output PNG is placed in a viewing application.

Because of this, there are some things to keep in mind:

  • If the color that you choose is identical to another color chosen for some object within the output, then the parts of that object that are the same color are also transparent (it doesn't affect just the background).

    For example, if you choose "White" as the transparent color, and you also have a chart in the output that has a white background to the chart area portion of the chart, the background for the PNG is considered transparent, as are the parts of the chart area that are white.

  • To actually have transparency applied by the application that displays the PNG, the pixel must be exactly the color set as transparent. With that, you must also consider that the engine that generates the PNG performs anti-aliasing (especially important for text). It creates pixels that are varying blends of the background and foreground colors around the edges of drawn objects, to fool your eye into seeing smooth shapes and curves. Therefore, you tend to get fine "halos" around non-transparent objects that are on top of the transparent background color.

    For example, if you choose "Magenta" as the background color, and you have black text in the output, you might notice a subtle pink halo around each letter, where the anti-aliasing has created the blended colors. Since those shades of pink aren’t exactly "Magenta", they are not considered transparent by the application in which you are viewing the PNG.