This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages) (Learn how and when to remove this message)
|

RGBA stands forred green blue alpha. While it is sometimes described as acolor space, it is actually a three-channelRGB color model supplemented with a fourthalpha channel. Alpha indicates how opaque each pixel is and allows an image to be combined over others usingalpha compositing, withtransparent areas andanti-aliasing of the edges of opaque regions. Each pixel is a4D vector.
The term doesnot define what RGB color space is being used. It also does not state whether or not the colors arepremultiplied by the alpha value, and if they are it does not state what color space that premultiplication was done in. This means more information than just "RGBA" is needed to determine how to handle an image.
In some contexts the abbreviation "RGBA" means a specific memory layout (calledRGBA8888 below), with other terms such as "BGRA" used for alternatives. In other contexts "RGBA" means any layout.
In computer graphics, pixels encoding the RGBA color space information must be stored incomputer memory (or in files on disk). In most cases four equal-sized pieces of adjacent memory are used, one for each channel, and a 0 in a channel indicates black color or transparent alpha, while all-1 bits indicates white or fully opaque alpha. By far the most common format is to store 8 bits (onebyte) for each channel, which is 32 bits for each pixel.
Theorder of these four bytes in memory can differ, which can lead to confusion when image data is exchanged. These encodings are often denoted by the four letters in some order (most commonly RGBA). The interpretation of these 4-letter mnemonics is not well established. There are two typical ways to understand the mnemonic "RGBA":
In abig-endian system, the two schemes are equivalent. This is not the case for alittle-endian system, where the two mnemonics are reverses of each other. Therefore, to be unambiguous, it is important to state which ordering is used when referring to the encoding. This article will use a scheme that has some popularity, which is to add the suffix "8888" to indicate if 4 8-bit units or "32" if one 32-bit unit are being discussed.
| Little-endian | Big-endian | |
|---|---|---|
| RGBA8888 | ABGR32 | RGBA32 |
| ARGB32 | BGRA8888 | ARGB8888 |
| RGBA32 | ABGR8888 | RGBA8888 |
InOpenGL andPortable Network Graphics (PNG), the RGBA byte order is used, where the colors are stored in memory such that R is at the lowest address, G after it, B after that, and A last. On a little endian architecture this is equivalent to ABGR32.[1]
In many systems when there are more than 8 bits per channel (such as 16 bits or floating-point), the channels are stored in RGBA order, even if 8-bit channels are stored in some other order.
The channels are arranged in memory in such manner that a single 32-bit unsigned integer has the alpha sample in the highest 8 bits, followed by the red sample, green sample and finally the blue sample in the lowest 8 bits:

ARGB values are typically expressed using 8hexadecimal digits, with each pair of the hexadecimal digits representing the values of the Alpha, Red, Green and Blue channel, respectively. For example,80FFFF00 represents 50.2% opaque (non-premultiplied) yellow. The80 hex value, which is 128 in decimal, represents a 50.2% alpha value because 128 is approximately 50.2% of the maximum value of 255 (FF hex); to continue to decipher the80FFFF00 value, the firstFF represents the maximum value red can have; the secondFF is like the previous but for green; the final00 represents the minimum value blue can have (effectively – no blue). Consequently, red + green yields yellow. In cases where the alpha is not used this can be shortened to 6 digitsRRGGBB, this is why it was chosen to put the alpha in the top bits. Depending on the context a0x or a number sign (#)[2] is put before the hex digits.
This layout became popular when 24-bit color (and 32-bit RGBA) was introduced on personal computers. At the time it was much faster and easier for programs to manipulate one 32-bit unit than four 8-bit units.
On little-endian systems, this is equivalent to BGRA byte order. On big-endian systems, this is equivalent to ARGB byte order.
This section'sfactual accuracy isdisputed. Relevant discussion may be found on thetalk page. Please help to ensure that disputed statements arereliably sourced.(December 2015) (Learn how and when to remove this message) |
In some software originating on big-endian machines such asSilicon Graphics, colors were stored in 32 bits similar to ARGB32, but with the alpha in thebottom 8 bits rather than the top. For example,808000FF would be Red and Green:50.2%, Blue:0% and Alpha:100%, a brown. This is what you would get if RGBA8888 data was read as words on these machines. It is used inPortable Arbitrary Map and inFLTK, but in general it is rare.
The bytes are stored in memory on a little-endian machine in the order ABGR.
#aarrggbb andsc# scA,scR,scG,scB