|
| 1 | +--- |
| 2 | +title: "ColorSpace Object" |
| 3 | +description: "" |
| 4 | +slug: color-space |
| 5 | +hide_title: false |
| 6 | +--- |
| 7 | + |
| 8 | +# ColorSpace Object |
| 9 | + |
| 10 | +* `primaries` string - The color primaries of the color space. Can be one of the following values: |
| 11 | + * `bt709` - BT709 primaries (also used for sRGB) |
| 12 | + * `bt470m` - BT470M primaries |
| 13 | + * `bt470bg` - BT470BG primaries |
| 14 | + * `smpte170m` - SMPTE170M primaries |
| 15 | + * `smpte240m` - SMPTE240M primaries |
| 16 | + * `film` - Film primaries |
| 17 | + * `bt2020` - BT2020 primaries |
| 18 | + * `smptest428-1` - SMPTEST428-1 primaries |
| 19 | + * `smptest431-2` - SMPTEST431-2 primaries |
| 20 | + * `p3` - P3 primaries |
| 21 | + * `xyz-d50` - XYZ D50 primaries |
| 22 | + * `adobe-rgb` - Adobe RGB primaries |
| 23 | + * `apple-generic-rgb` - Apple Generic RGB primaries |
| 24 | + * `wide-gamut-color-spin` - Wide Gamut Color Spin primaries |
| 25 | + * `ebu-3213-e` - EBU 3213-E primaries |
| 26 | + * `custom` - Custom primaries |
| 27 | + * `invalid` - Invalid primaries |
| 28 | + |
| 29 | +* `transfer` string - The transfer function of the color space. Can be one of the following values: |
| 30 | + * `bt709` - BT709 transfer function |
| 31 | + * `bt709-apple` - BT709 Apple transfer function |
| 32 | + * `gamma18` - Gamma 1.8 transfer function |
| 33 | + * `gamma22` - Gamma 2.2 transfer function |
| 34 | + * `gamma24` - Gamma 2.4 transfer function |
| 35 | + * `gamma28` - Gamma 2.8 transfer function |
| 36 | + * `smpte170m` - SMPTE170M transfer function |
| 37 | + * `smpte240m` - SMPTE240M transfer function |
| 38 | + * `linear` - Linear transfer function |
| 39 | + * `log` - Log transfer function |
| 40 | + * `log-sqrt` - Log Square Root transfer function |
| 41 | + * `iec61966-2-4` - IEC61966-2-4 transfer function |
| 42 | + * `bt1361-ecg` - BT1361 ECG transfer function |
| 43 | + * `srgb` - sRGB transfer function |
| 44 | + * `bt2020-10` - BT2020-10 transfer function |
| 45 | + * `bt2020-12` - BT2020-12 transfer function |
| 46 | + * `pq` - PQ (Perceptual Quantizer) transfer function |
| 47 | + * `smptest428-1` - SMPTEST428-1 transfer function |
| 48 | + * `hlg` - HLG (Hybrid Log-Gamma) transfer function |
| 49 | + * `srgb-hdr` - sRGB HDR transfer function |
| 50 | + * `linear-hdr` - Linear HDR transfer function |
| 51 | + * `custom` - Custom transfer function |
| 52 | + * `custom-hdr` - Custom HDR transfer function |
| 53 | + * `scrgb-linear-80-nits` - scRGB Linear 80 nits transfer function |
| 54 | + * `invalid` - Invalid transfer function |
| 55 | + |
| 56 | +* `matrix` string - The color matrix of the color space. Can be one of the following values: |
| 57 | + * `rgb` - RGB matrix |
| 58 | + * `bt709` - BT709 matrix |
| 59 | + * `fcc` - FCC matrix |
| 60 | + * `bt470bg` - BT470BG matrix |
| 61 | + * `smpte170m` - SMPTE170M matrix |
| 62 | + * `smpte240m` - SMPTE240M matrix |
| 63 | + * `ycocg` - YCoCg matrix |
| 64 | + * `bt2020-ncl` - BT2020 NCL matrix |
| 65 | + * `ydzdx` - YDzDx matrix |
| 66 | + * `gbr` - GBR matrix |
| 67 | + * `invalid` - Invalid matrix |
| 68 | + |
| 69 | +* `range` string - The color range of the color space. Can be one of the following values: |
| 70 | + * `limited` - Limited color range (RGB values ranging from 16 to 235) |
| 71 | + * `full` - Full color range (RGB values from 0 to 255) |
| 72 | + * `derived` - Range defined by the transfer function and matrix |
| 73 | + * `invalid` - Invalid range |
| 74 | + |
| 75 | +## Common `ColorSpace` definitions |
| 76 | + |
| 77 | +### Standard Color Spaces |
| 78 | + |
| 79 | +**sRGB**: |
| 80 | + |
| 81 | + ```js |
| 82 | + const cs = { |
| 83 | + primaries: 'bt709', |
| 84 | + transfer: 'srgb', |
| 85 | + matrix: 'rgb', |
| 86 | + range: 'full' |
| 87 | + } |
| 88 | + ``` |
| 89 | + |
| 90 | +**Display P3**: |
| 91 | + |
| 92 | + ```js |
| 93 | + const cs = { |
| 94 | + primaries: 'p3', |
| 95 | + transfer: 'srgb', |
| 96 | + matrix: 'rgb', |
| 97 | + range: 'full' |
| 98 | + } |
| 99 | + ``` |
| 100 | + |
| 101 | +**XYZ D50**: |
| 102 | + |
| 103 | + ```js |
| 104 | + const cs = { |
| 105 | + primaries: 'xyz-d50', |
| 106 | + transfer: 'linear', |
| 107 | + matrix: 'rgb', |
| 108 | + range: 'full' |
| 109 | + } |
| 110 | + ``` |
| 111 | + |
| 112 | +### HDR Color Spaces |
| 113 | + |
| 114 | +**Extended sRGB** (extends sRGB to all real values): |
| 115 | + |
| 116 | + ```js |
| 117 | + const cs = { |
| 118 | + primaries: 'bt709', |
| 119 | + transfer: 'srgb-hdr', |
| 120 | + matrix: 'rgb', |
| 121 | + range: 'full' |
| 122 | + } |
| 123 | + ``` |
| 124 | + |
| 125 | +**scRGB Linear** (linear transfer function for all real values): |
| 126 | + |
| 127 | + ```js |
| 128 | + const cs = { |
| 129 | + primaries: 'bt709', |
| 130 | + transfer: 'linear-hdr', |
| 131 | + matrix: 'rgb', |
| 132 | + range: 'full' |
| 133 | + } |
| 134 | + ``` |
| 135 | + |
| 136 | +**scRGB Linear 80 Nits** (with an SDR white level of 80 nits): |
| 137 | + |
| 138 | + ```js |
| 139 | + const cs = { |
| 140 | + primaries: 'bt709', |
| 141 | + transfer: 'scrgb-linear-80-nits', |
| 142 | + matrix: 'rgb', |
| 143 | + range: 'full' |
| 144 | + } |
| 145 | + ``` |
| 146 | + |
| 147 | +**HDR10** (BT.2020 primaries with PQ transfer function): |
| 148 | + |
| 149 | + ```js |
| 150 | + const cs = { |
| 151 | + primaries: 'bt2020', |
| 152 | + transfer: 'pq', |
| 153 | + matrix: 'rgb', |
| 154 | + range: 'full' |
| 155 | + } |
| 156 | + ``` |
| 157 | + |
| 158 | +**HLG** (BT.2020 primaries with HLG transfer function): |
| 159 | + |
| 160 | + ```js |
| 161 | + const cs = { |
| 162 | + primaries: 'bt2020', |
| 163 | + transfer: 'hlg', |
| 164 | + matrix: 'rgb', |
| 165 | + range: 'full' |
| 166 | + } |
| 167 | + ``` |
| 168 | + |
| 169 | +### Video Color Spaces |
| 170 | + |
| 171 | +**Rec. 601** (SDTV): |
| 172 | + |
| 173 | + ```js |
| 174 | + const cs = { |
| 175 | + primaries: 'smpte170m', |
| 176 | + transfer: 'smpte170m', |
| 177 | + matrix: 'smpte170m', |
| 178 | + range: 'limited' |
| 179 | + } |
| 180 | + ``` |
| 181 | + |
| 182 | +**Rec. 709** (HDTV): |
| 183 | + |
| 184 | + ```js |
| 185 | + const cs = { |
| 186 | + primaries: 'bt709', |
| 187 | + transfer: 'bt709', |
| 188 | + matrix: 'bt709', |
| 189 | + range: 'limited' |
| 190 | + } |
| 191 | + ``` |
| 192 | + |
| 193 | +**JPEG** (typical color space for JPEG images): |
| 194 | + |
| 195 | + ```js |
| 196 | + const cs = { |
| 197 | + primaries: 'bt709', |
| 198 | + transfer: 'srgb', |
| 199 | + matrix: 'smpte170m', |
| 200 | + range: 'full' |
| 201 | + } |
| 202 | + ``` |
0 commit comments