In addition, transparency is often an "extra" for a graphics format, and some graphics programs will ignore the transparency.
Most vector formats implicitly support transparency because they simply avoid putting any objects at a given point. This includes EPS and WMF. For vector graphics this may not strictly be seen as transparency, but it requires much of the same careful programming as transparency in raster formats.
A suitable raster graphics editor shows transparency by a special pattern, e.g. a chessboard pattern.
One color entry in a single GIF or PNG image's palette can be defined as "transparent" rather than an actual color. This means that when the decoder encounters a pixel with this value, it is rendered in the background color of the part of the screen where the image is placed, also if this varies pixel-by-pixel as in the case of a background image.
The transparent color should be chosen carefully, to avoid items that just happen to be the same color vanishing.
Even this limited form of transparency has patchy implementation, though most popular web browsers are capable of displaying transparent GIF images. This support often does not extend to printing, especially to printing devices (such as PostScript) which do not include support for transparency in the device or driver. Outside the world of web browsers, support is fairly hit-or-miss for transparent GIF files.
The edges of characters and other images with transparent background should not have shades of gray: these are normally used for intermediate colors between the color of the letter/image and that of the background, typically shades of gray being intermediate between a black letter and a white background. However, with for example a red background the intermediate colors would be dark red, and gray edge pixels give an ugly and unclear result. For a variable background color there are no suitable fixed intermediate colors.
PNG and TIFF also allows partial transparency, which solves the edge limitation problem. However, support is even more patchy. Internet Explorer prior to version 7 does not support partial transparency in a PNG graphic. Very few applications correctly process TIFF files with alpha channels.
A major use of partial transparency, but not the only one, is to produce "soft edges" in graphics so that they blend into their background. See also monochrome or with shades of gray and anti-aliasing.
The process of combining a partially transparent color with its background ("compositing") is often ill-defined and the results may not be exactly the same in all cases. For example, where color correction is in use, should the colors be composited before or after color correction?
In this example, two grayscale colors are to be composited. Grayscale values are considered to be numbers between 0.0 (white) and 1.0 (black). To emphasize: this is only one possible rule for transparency. If working with transparency, check the rules in use for your situation.
The color at a point, where color G1 and G2 are to be combined, is . Some consequences of this are:
((G1 + G2 ) /2 + G3 ) / 2 = G1 / 4 + G2 / 4 + G3 / 2
(G1 + (G2 + G3 ) / 2 ) / 2 = G1 / 2 + G2 / 4 + G3 / 4This is important as it means that when combining three or more objects with this rule for transparency, the final color depends very much on the order of doing the calculations.
Although the formula is simple, it may not be ideal. Human perception of brightness is not linear - we do not necessarily consider that a gray value of 0.5 is halfway between black and white. Such details may not matter when transparency is used only to soften edges, but in more complex designs this may be significant. Most people working seriously with transparency will need to see the results and may fiddle with the colors or (where possible) the algorithm to arrive at the results they need.
This formula can easily be generalized to RGB color or CMYK color by applying the formula to each channel separately. For example, final . But it cannot be applied to all color models. For example Lab color would produce results that were surprising.
An alternative model is that at every point in each element to be combined for transparency there is an associated color and opacity between 0 and 1. For each color channel, you might work with this model: if a channel with intensity and opacity overlays a channel with intensity and opacity the result will be a channel with intensity equal to , and opacity . When one is left with a single result after blending, the final result in each channel is multiplied by the final opacity. During intermediate calculations the channel values may be more than the maximum, and the final calculation will bring it back into range. The SVG file specification uses this type of blending, and this is one of the models that can be used in PDF.
Alpha channels may be implemented in this way, where the alpha channel provides an opacity level to be applied equally to all other channels. To work with the above formula, the opacity needs to be scaled to the range 0 to 1, whatever its external representation (often 0 to 255 if using 8 bit samples such as "RGBA").
Starting with version 1.4 of the PDF standard, transparency (including translucency) is supported. This is a very complex model, requiring over 100 pages to document. A key source of complication is that PDF files may contain objects with different color spaces, and blending these is tricky. PDF supports many different blend modes, not just the most common averaging method. In addition, the rules for compositing many overlapping objects allow choices, such as whether a group of objects are blended before being blended with the background, or whether each object in turn is blended into the background.
Adobe Acrobat 5.0 was the first to support PDF 1.4 and, hence, transparent PDF files. Transparency in PDF was carefully designed not to cause errors in PDF viewers that did not understand it, they would simply display all elements as fully opaque. This was a two-edged sword. On the one hand, it reduced errors and complaints about errors; on the other hand it meant people with older viewers, PDF printers, etc. might print something completely different from the original design, increasing complaints about incorrect output. When PDF files are used to prepare work for professional printing, transparency issues could cause millions of printed copies to be incorrect, and have to be destroyed.
In addition, few of the programs that generate EPS previews will generate transparency information in the preview.
Some programs have sought to get around this by treating all white in the preview as transparent, but this too is problematic in the cases where some whites are not transparent.
More recently, applications have been appearing that ignore the preview altogether; they therefore get information on which parts of the preview to paint by interpreting the PostScript.