Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
RGBA color model
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|RGB color model with an opacity channel}} {{redirect|ARGB|the colorspace developed by Adobe in the late 1990s|Adobe RGB color space}} {{Use dmy dates|date=October 2020}} {{multiple issues| {{more footnotes|date=October 2012}} {{more citations needed|date=October 2012}} }} [[File:RGBA comp.png|thumb|240px|Example of an RGBA image composited over a checkerboard background. alpha is 0% at the top and 100% at the bottom.]] '''RGBA''' stands for '''red green blue alpha'''. While it is sometimes described as a [[color space]], it is actually a three-channel [[RGB color model]] supplemented with a fourth ''alpha channel''. Alpha indicates how opaque each pixel is and allows an image to be combined over others using [[alpha compositing]], with [[transparency (graphic)|transparent]] areas and [[spatial anti-aliasing|anti-aliasing]] of the edges of opaque regions. Each pixel is a [[4D vector]]. The term does ''not'' define what RGB color space is being used. It also does not state whether or not the colors are [[alpha compositing#premultiplied|premultiplied]] 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 (called [[#RGBA8888|RGBA8888]] below), with other terms such as "BGRA" used for alternatives. In other contexts "RGBA" means any layout. == Representation == In computer graphics, pixels encoding the RGBA color space information must be stored in [[computer 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 (one [[byte]]) for each channel, which is 32 bits for each pixel. The ''order'' 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 the byte-order scheme, "RGBA" is understood to mean a byte R, followed by a byte G, followed by a byte B, and followed by a byte A. This scheme is commonly used for describing file formats or network protocols, which are both byte-oriented. * In the word-order scheme, "RGBA" is understood to represent a complete 32-bit word, where R is more significant than G, which is more significant than B, which is more significant than A. In a [[big-endian]] system, the two schemes are equivalent. This is not the case for a [[little-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. {|class="wikitable" | style="text-align: center;" |+RGBA representation converter ! !!Little-endian!!Big-endian |- !scope="col" style="text-align: left;"|RGBA8888 |ABGR32 |RGBA32 |- !scope="col"|ARGB32 |BGRA8888 |ARGB8888 |- !scope="col"|RGBA32 |ABGR8888 |RGBA8888 |} === RGBA8888 === In [[OpenGL]] and [[Portable 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.<ref>{{Cite web|title=Portable Network Graphics (PNG) Specification (Second Edition)|url=https://www.w3.org/TR/2003/REC-PNG-20031110/index.html|access-date=2021-11-25|website=www.w3.org}}</ref> 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. === ARGB32 === 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: [[File:PixelSamples32bppRGBA.png|none|Sample layout in a typical 32bpp pixel]] ARGB values are typically expressed using 8 [[hexadecimal]] digits, with each pair of the hexadecimal digits representing the values of the Alpha, Red, Green and Blue channel, respectively. For example, <code>80FFFF00</code> represents 50.2% opaque (non-premultiplied) yellow. The <code>80</code> 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 the <code>80FFFF00</code> value, the first <code>FF</code> represents the maximum value red can have; the second <code>FF</code> is like the previous but for green; the final <code>00</code> 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 digits <code>RRGGBB</code>, this is why it was chosen to put the alpha in the top bits. Depending on the context a <code>0x</code> or a number sign (#)<ref>[http://msdn.microsoft.com/en-us/library/system.windows.media.color(v=vs.95).aspx Microsoft MSDN XAML Color Structure reference] (XAML/WPF/Silverlight), including <code>#aarrggbb</code> and <code>sc# scA,scR,scG,scB</code></ref> 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. === RGBA32 === {{Disputed section|date=December 2015}} In some software originating on big-endian machines such as [[Silicon Graphics]], colors were stored in 32 bits similar to ARGB32, but with the alpha in the ''bottom'' 8 bits rather than the top. For example, <code>808000FF</code> 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 in [[Netpbm#Transparency|Portable Arbitrary Map]] and in [[FLTK]], but in general it is rare. [[File:HexRGBAbits.png|RGBA pixel layout]] The bytes are stored in memory on a little-endian machine in the order ABGR. == See also == * [[Portable Network Graphics]] == References == {{Reflist}} ==External links== * [http://www.w3.org/TR/PNG-DataRep.html#DR.Alpha-channel Alpha transparency] on [[W3C]] PNG specification * [http://www.css3.info/preview/rgba/ RGBA Colors] β Preview page with implementation info on CSS3.info {{DEFAULTSORT:Rgba Color Space}} [[Category:Color space]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Disputed section
(
edit
)
Template:Multiple issues
(
edit
)
Template:Redirect
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use dmy dates
(
edit
)