Color format

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{FormatInfo
 +
|formattype=electronic
 +
|subcat=Elements of File Formats
 +
}}
 
A '''color format''', not to be confused with [[Color profiles]] or [[Graphics|Graphics formats]], describe the way in which data is stored within an image and specifically concerns the way that data is loaded by dedicated graphics hardware. The concept of a '''color format''' has an inconsistent nomenclature, often referred to as ''Pixel'', ''Texture'', ''Image'', or ''Graphics'' formats. In [[Direct3D]], these are known as ''Surface Formats''.
 
A '''color format''', not to be confused with [[Color profiles]] or [[Graphics|Graphics formats]], describe the way in which data is stored within an image and specifically concerns the way that data is loaded by dedicated graphics hardware. The concept of a '''color format''' has an inconsistent nomenclature, often referred to as ''Pixel'', ''Texture'', ''Image'', or ''Graphics'' formats. In [[Direct3D]], these are known as ''Surface Formats''.
  
 
Often, dedicated graphics hardware has a fixed range of supported '''color formats''', chosen to meet both industry needs of those which integrate with the hardware and whatever will offer the best performance or stability on said hardware.
 
Often, dedicated graphics hardware has a fixed range of supported '''color formats''', chosen to meet both industry needs of those which integrate with the hardware and whatever will offer the best performance or stability on said hardware.
  
A color format is broken down into the number of bits reserved for each color, and the order of those bytes, i.e. ''R8G8B8''. As color formats concern graphics hardware, they often are only concerned with the ''red'', ''blue'', ''green'' and ''alpha'' channels. Although, some formats exist for other display purposes, such as ''normal maps'' or ''depth maps''.  
+
A color format is broken down into the number of bits reserved for each color, and the order of those bits, i.e. ''R8G8B8''. As color formats concern graphics hardware, they often specify the ''red'', ''blue'', ''green'' and ''alpha'' channels. Although, some formats exist for other graphics purposes, such as ''normal maps'' or ''depth maps''.  
  
 
The more bits which are allocated, the more potential colors can be reproduced with that format. However, this comes at the cost of size. As humans are more sensitive to changes in luminance than colour, and more sensitive to certain wave-lengths of light, some formats specifically under-allocate bits to certain channels as a compromise between visual fidelity and size.
 
The more bits which are allocated, the more potential colors can be reproduced with that format. However, this comes at the cost of size. As humans are more sensitive to changes in luminance than colour, and more sensitive to certain wave-lengths of light, some formats specifically under-allocate bits to certain channels as a compromise between visual fidelity and size.
Line 41: Line 45:
 
== Example ==
 
== Example ==
  
The most simplest color format is '''R8G8B8''', signifying that 8-bits (a [[byte]]) are reserved for the ''red'', ''blue'', ''green'' channels, respectively. Totalling 24-bits per pixel. This allows each channel to range between 0-255 values, for a total of over 16 million potential colours.
+
The most simplest color format is a 1-bit format, which has 2 colors (usually black and white).
 +
 
 +
The most common color format is '''R8G8B8''', signifying that 8-bits (a [[byte]]) are reserved for the ''red'', ''blue'', ''green'' channels, respectively. Totalling 24-bits per pixel. This allows each channel to range between 0-255 values, for a total of over 16 million potential colours. The range is not linear but an [[sRGB]] scale.
  
 
By comparison, the '''A8B8G8R8''' is similar to above, with an additional 8-bits for alpha information — totalling 32-bits per pixel. Whether the alpha is expected to be ''premultiplied'' or ''straight'' is determined by the hardware.
 
By comparison, the '''A8B8G8R8''' is similar to above, with an additional 8-bits for alpha information — totalling 32-bits per pixel. Whether the alpha is expected to be ''premultiplied'' or ''straight'' is determined by the hardware.
 +
 +
== R5G6B5 ==
 +
 +
'''R5G6B5''' was a common format for early 3D game consoles. Which allowed 5-bits for ''red'' and ''blue'', and 6-bits for ''green''. The additional ''green'' bits were owed to the human eye's higher-sensitivity to green light. This results in 16-bit pixels.
  
 
== See also ==
 
== See also ==
Line 50: Line 60:
 
* [https://switchbrew.org/wiki/GPU_Texture_Formats GPU Texture formats] on the SwitchBrew wiki
 
* [https://switchbrew.org/wiki/GPU_Texture_Formats GPU Texture formats] on the SwitchBrew wiki
 
* [https://learn.microsoft.com/en-us/previous-versions/windows/desktop/bb153344(v=vs.85) Direct3D Surfaces] and [https://learn.microsoft.com/en-us/previous-versions/ms859044(v=msdn.10)?redirectedfrom=MSDN Surface Format] documentation.
 
* [https://learn.microsoft.com/en-us/previous-versions/windows/desktop/bb153344(v=vs.85) Direct3D Surfaces] and [https://learn.microsoft.com/en-us/previous-versions/ms859044(v=msdn.10)?redirectedfrom=MSDN Surface Format] documentation.
+
 
 +
[[Category:Graphics]]

Latest revision as of 11:22, 16 August 2024

File Format
Name Color format
Ontology

A color format, not to be confused with Color profiles or Graphics formats, describe the way in which data is stored within an image and specifically concerns the way that data is loaded by dedicated graphics hardware. The concept of a color format has an inconsistent nomenclature, often referred to as Pixel, Texture, Image, or Graphics formats. In Direct3D, these are known as Surface Formats.

Often, dedicated graphics hardware has a fixed range of supported color formats, chosen to meet both industry needs of those which integrate with the hardware and whatever will offer the best performance or stability on said hardware.

A color format is broken down into the number of bits reserved for each color, and the order of those bits, i.e. R8G8B8. As color formats concern graphics hardware, they often specify the red, blue, green and alpha channels. Although, some formats exist for other graphics purposes, such as normal maps or depth maps.

The more bits which are allocated, the more potential colors can be reproduced with that format. However, this comes at the cost of size. As humans are more sensitive to changes in luminance than colour, and more sensitive to certain wave-lengths of light, some formats specifically under-allocate bits to certain channels as a compromise between visual fidelity and size.

Whilst there is no standardisation of the letters when describing a format, the following are commonly used:

Letter Purpose
R Red
G Green (or Grey)
B Blue
A Alpha
L Luminance
U, V, W & Q Bump or normal data
P Palette index (i.e. a P8 denotes a palette of 256 colors)
X Padding bits (ignored but kept for alignment)

[edit] Example

The most simplest color format is a 1-bit format, which has 2 colors (usually black and white).

The most common color format is R8G8B8, signifying that 8-bits (a byte) are reserved for the red, blue, green channels, respectively. Totalling 24-bits per pixel. This allows each channel to range between 0-255 values, for a total of over 16 million potential colours. The range is not linear but an sRGB scale.

By comparison, the A8B8G8R8 is similar to above, with an additional 8-bits for alpha information — totalling 32-bits per pixel. Whether the alpha is expected to be premultiplied or straight is determined by the hardware.

[edit] R5G6B5

R5G6B5 was a common format for early 3D game consoles. Which allowed 5-bits for red and blue, and 6-bits for green. The additional green bits were owed to the human eye's higher-sensitivity to green light. This results in 16-bit pixels.

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox