HOME

TheInfoList



OR:

Transparency in
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
is possible in a number of
file formats A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free. Some file formats ...
. The term " transparency" is used in various ways by different people, but at its simplest there is "full transparency" i.e. something that is completely invisible. Only part of a graphic should be fully transparent, or there would be nothing to see. More complex is "partial transparency" or "translucency" where the effect is achieved that a graphic is partially transparent in the same way as colored glass. Since ultimately a printed page or computer or television screen can only be one color at a point, partial transparency is always simulated at some level by mixing colors. There are many different ways to mix colors, so in some cases transparency is ambiguous. In addition, transparency is often an "extra" for a graphics format, and some graphics programs will ignore the transparency.
Raster Raster may refer to: * Raster graphics, graphical techniques using arrays of pixel values * Raster graphics editor, a computer program * Raster scan, the pattern of image readout, transmission, storage, and reconstruction in television and compu ...
file formats that support transparency include
GIF The Graphics Interchange Format (GIF; or , see pronunciation) is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. ...
, PNG, BMP,
TIFF Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word process ...
, TGA and JPEG 2000, through either a ''transparent color'' or an
alpha channel In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
. Most
vector Vector most often refers to: *Euclidean vector, a quantity with a magnitude and a direction *Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematic ...
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. More complex vector formats may allow transparency combinations between the elements within the graphic, as well as that above. This includes SVG and
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
. A suitable
raster graphics editor A raster graphics editor is a computer program that allows users to create and edit images interactively on the computer screen and save them in one of many raster graphics file formats (also known as bitmap images) such as JPEG, PNG, and GI ...
shows transparency by a special pattern, e.g. a checkerboard pattern.


Transparent pixels

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 An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensiona ...
. Applications include: * an image that is not rectangular can be filled to the required rectangle using transparent surroundings; the image can even have holes (e.g. be ring-shaped) * in a run of text, a special symbol for which an image is used because it is not available in the character set, can be given a transparent background, resulting in a matching background. 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 PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
) 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.


Edge limitations of transparent pixels

The edges of characters and other images with transparent background should not have
shades of gray Variations of gray or grey include achromatic grayscale shades, which lie exactly between white and black, and nearby colors with low colorfulness. A selection of a number of these various colors is shown below. Chart of computer web color ...
: 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. Gray edge pixels would give an ugly and unclear result. For a variable background color there are no suitable fixed intermediate colors.


Partial transparency by alpha channels

Some image formats, such as PNG and TIFF, also allow partial transparency through an alpha channel, which solves the edge limitation problem. Instead of each pixel either being transparent or not transparent, it can be set to 254 levels of partially transparent, allowing some of the background image to show through the foreground image. A major use of partial transparency 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 Anti-aliasing may refer to any of a number of techniques to combat the problems of aliasing in a sampled signal such as a digital image or digital audio recording. Specific topics in anti-aliasing include: * Anti-aliasing filter, a filter used be ...
. Partial transparency can also be used to make an image less prominent, such as a watermark or other logo; or to render something see-through, such as a ghostly apparition in a video game. Animating the alpha channel in an image-editing program can allow smooth transitions between different images. 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?


Transparency by clipping path

An alternative approach to full transparency is to use a
Clipping path A clipping path (or "deep etch") is a closed vector path, or shape, used to cut out a 2D image in image editing software. Anything inside the path will be included after the clipping path is applied; anything outside the path will be omitted f ...
. A clipping path is simply a shape or outline, that is used in conjunction with the other graphics. Everything inside the path is visible, and everything outside the path is invisible. The path is inherently vector, but can potentially be used to mask both vector and bitmap data. The main usage of clipping paths is in PostScript files.


Compositing calculations

While some transparency specifications are vague, others may give mathematical details of how two colors are to be composited. This gives a fairly simple example of how compositing calculations can work, can produce the expected results, and can also produce surprises. 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: * Where the colors are equal, the result is the same color because . * Where one color (G1) is white (0.0), the result is . This will always be less than any nonzero value of G2, so the result is whiter than G2. (This is easily reversed for the case where G2 is white). * Where one color (G1) is black (1.0), the result is . This will always be more than G2, so the result is blacker than G2. * The formula is
commutative In mathematics, a binary operation is commutative if changing the order of the operands does not change the result. It is a fundamental property of many binary operations, and many mathematical proofs depend on it. Most familiar as the name o ...
since . This means it does not matter which order two graphics are mixed i.e. which of the two is on the top and which is on the bottom. * The formula is ''not'' associative since ( ( G1 + G2 ) / 2 + G3 ) / 2 = G1 / 4 + G2 / 4 + G3 / 2 ( G1 + ( G2 + G3 ) / 2 ) / 2 = G1 / 2 + G2 / 4 + G3 / 4 This 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 The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three addi ...
color or
CMYK The CMYK color model (also known as process color, or four color) is a subtractive color model, based on the CMY color model, used in color printing, and is also used to describe the printing process itself. The abbreviation ''CMYK'' refers ...
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 . Each channel must be multiplied by corresponding alpha value before composition (so called premultiplied alpha). 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").


Transparency in PDF

Starting with version 1.4 of the PDF standard ( Adobe Acrobat version 5), transparency (including translucency) is supported. Transparency in PDF files allows creators to achieve various effects, including adding shadows to objects, making objects semi-transparent and having objects blend into each other or into text. PDF supports many different
blend modes A blend is a mixture of two or more different things or substances; e.g., a product of a Blender, mixer or blender. Blend Blend may also refer to: * Blend word, a word formed from parts of other words * Blend (album), ''Blend'' (album), a 1996 ...
, not just the most common averaging method, and 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). PDF transparency is a very complex model, its original specification by Adobe being over 100 pages long. A key source of complication is that blending objects with different
color spaces A color space is a specific organization of colors. In combination with color profiling supported by various physical devices, it supports reproducible representations of colorwhether such representation entails an analog or a digital represent ...
can be tricky and error-prone as well as cause compatibility issues. Transparency in PDF was designed not to cause errors in PDF viewers that did not understand it – they would simply display all elements as fully opaque. However, this was a two-edged sword as users with older viewers, PDF printers, etc. could see or print something completely different from the original design. The fact that the PDF transparency model is so complicated means that it is not well supported. This means that RIPs and printers often have problems printing PDFs with transparency. The solution to this is either to rasterize the image or to apply vector transparency flattening to the PDF. However vector transparency flattening is extremely complex and only supported by a few specialist packages.


Transparency in PostScript

The
PostScript PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
language has limited support for full (not partial) transparency, depending on the PostScript level. Partial transparency is available with the pdfmark extension, available on many PostScript implementations.


Level 1

Level 1 PostScript offers transparency via two methods: * A one-bit (monochrome) image can be treated as a mask. In this case the 1-bits can be painted any single color, while the 0-bits are not painted at all. This technique cannot be generalised to more than one color, or to vector shapes. * Clipping paths can be defined. These restrict what part of all subsequent graphics can be seen. This can be used for any kind of graphic, however in level 1, the maximum number of nodes in a path was often limited to 1500, so complex paths (e.g. cutting around the hair in a photograph of a person's head) often failed.


Level 2

Level 2 PostScript adds no specific transparency features. However, by the use of patterns, arbitrary graphics can be painted through masks defined by any vector or text operations. This is, however, complex to implement. In addition, this too often reached implementation limits, and few if any application programs ever offered this technique.


Level 3

Level 3 PostScript adds further transparency option for any raster image. A transparent color, or range of colors, can be applied; or a separate 1-bit mask can be used to provide an alpha channel.


Encapsulated PostScript

EPS files contain PostScript, which may be level 1, 2 or 3 and make use of the features above. A more subtle issue arises with the previews for EPS files that are typically used to show the view of the EPS file on screen. There are viable techniques for setting transparency in the preview. For example, a TIFF preview might use a TIFF alpha channel. However, many applications do not use this transparency information and will therefore show the preview as a rectangle. A semi-proprietary technique pioneered in
Photoshop Adobe Photoshop is a raster graphics editor developed and published by Adobe Inc. for Windows and macOS. It was originally created in 1988 by Thomas and John Knoll. Since then, the software has become the industry standard not only in raster ...
and adopted by a number of pre-press applications is to store a clipping path in a standard location of the EPS, and use that for display. 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.


See also

*
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for th ...
* Transparent color in palettes *
Image mask In computer science, a mask or bitmask is data that is used for bitwise operations, particularly in a bit field. Using a mask, multiple bits in a byte, nibble, word, etc. can be set either on or off, or inverted from on to off (or vice versa) i ...
s *
Alpha channel In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
*
Magic pink Chroma key compositing, or chroma keying, is a Visual effects, visual-effects and post-production technique for compositing (layering) two images or video streams together based on colour hues (colorfulness, chroma range). The technique has b ...
*
Video overlay {{Distinguish, on-screen display Video overlay is any technique used to display a video window on a computer display while bypassing the chain of CPU to graphics card to computer monitor. This is done in order to speed up the video display, and it ...
*
Genlock Genlock (generator locking) is a common technique where the video output of one source (or a specific reference signal from a signal generator) is used to synchronize other picture sources together. The aim in video applications is to ensure the ...
*
Bitblit Bit blit (also written BITBLT, BIT BLT, BitBLT, Bit BLT, Bit Blt etc., which stands for ''bit block transfer'') is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a ''boolean function''. The ...


References

{{DEFAULTSORT:Transparency (Graphic) Digital art Computer graphics