#109630Predefined value options for `sys_file_metadata.color_space` are wrong and incomplete
Description
The accepted values for sys_file_metadata.color_space are defined as:
[
['label' => 'filemetadata.db:sys_file_metadata.color_space.RGB', 'value' => 'RGB'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.sRGB', 'value' => 'sRGB'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.CMYK', 'value' => 'CMYK'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.CMY', 'value' => 'CMY'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.YUV', 'value' => 'YUV'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.grey', 'value' => 'grey'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.indx', 'value' => 'indx'],
]
They date back to https://github.com/TYPO3/typo3/commit/df73316a942141418285df633c2f0f18dfb59d7b#diff-9351198f2961db2960ea6ffd6589c2317efdb0768cc3ae360e6d0929c74dfe79R361-R366, which was reviewed and approved in https://review.typo3.org/c/Packages/TYPO3.CMS/+/24715/1 on 2013-10-15.
Some of these values are incorrect, and many options are missing.
The incorrect list was carried over from DAM (https://extensions.typo3.org/extension/dam), which defined:
'color_space' => array(
'label' => 'LLL:EXT:dam/locallang_db.xml:tx_dam_item.color_space',
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly',
'exclude' => '0',
'config' => array(
'type' => 'select',
'items' => array(
array('', ''),
array('RGB', 'RGB'),
// This is not a colorspace but a color profile array('sRGB', 'sRGB'),
array('CMYK', 'CMYK'),
array('CMY', 'CMY'),
array('YUV', 'YUV'),
array('Grey', 'grey'),
array('indexed', 'indx'),
),
'default' => ''
)
),
Note that DAM already incorrectly defines 'grey' rather than the canonical 'GRAY', and it incorrectly defines 'YUV' rather than the canonical 'YCbr'.
But DAM correctly excludes sRGB, as sRGB is not a valid ICC color space data signature. (The ICC spec uses ‘RGB ‘ as the signature for any RGB-encoded image, regardless of whether the specific encoding is sRGB, Adobe RGB, ProPhoto, etc. Which specific RGB encoding is in use is conveyed by the attached ICC profile, not by the ColorSpaceData field.)
The conflation of the two was mistakenly introduced in https://github.com/TYPO3/typo3/commit/294a837b2222d1ebdb54337cba2fe6cbebede4ae (reviewed in https://review.typo3.org/c/Packages/TYPO3.CMS/+/44220), resolving https://forge.typo3.org/issues/70946, which was already based on the same incorrect premise.
The incorrect addition of sRGB to the color space list had worked as a band-aid to incorrect assumptions in EXT:extractor, but it must be removed, and metadata extraction fixed by no longer conflating color mode (fixed: https://github.com/xperseguers/t3ext-extractor/issues/89), color profile (unfixed) and color space.
The TYPO3 core’s incorrect color space list has also surfaced as https://github.com/xperseguers/t3ext-extractor/issues/83, although the actual bug is in TYPO3 EXT:filemetadata:
The ColorSpaceData value "GRAY", as observed in EXT:extractor#83, is in fact canonical, while 'grey' defined in https://github.com/TYPO3/typo3/blob/aa737bfbafc09cfd532d93582e5dcd693d5795a9/typo3/sysext/filemetadata/Configuration/TCA/Overrides/sys_file_metadata.php#L413-L419 is incorrect.
Aligning sys_file_metadata.color_space with the canonical ICC definition:
The set of correct values is defined in https://www.color.org/specification/ICC.1-2022-05.pdf in Table 19 — Data colour space signatures, in section 7.2.6 Data colour space field (bytes 16 to 20) on numbered page 21, which maps to physical PDF page 35.
Table 19 — Data colour space signatures
| _.Colour space type | _.Signature | _.Hex encoding |
|---|---|---|
| nCIEXYZ or PCSXYZ | ‘XYZ ’ | 58595A20h |
| CIELAB or PCSLAB | ‘Lab ’ | 4C616220h |
| CIELUV | ‘Luv ’ | 4C757620h |
| YCbCr | ‘YCbr’ | 59436272h |
| CIEYxy | ‘Yxy ’ | 59787920h |
| RGB | ‘RGB ’ | 52474220h |
| Gray | ‘GRAY’ | 47524159h |
| HSV | ‘HSV ’ | 48535620h |
| HLS | ‘HLS ’ | 484C5320h |
| CMYK | ‘CMYK’ | 434D594Bh |
| CMY | ‘CMY ’ | 434D5920h |
| 2 colour | ‘2CLR’ | 32434C52h |
| 3 colour (other than those listed above) | ‘3CLR’ | 33434C52h |
| 4 colour (other than CMYK) | ‘4CLR’ | 34434C52h |
| 5 colour | ‘5CLR’ | 35434C52h |
| 6 colour | ‘6CLR’ | 36434C52h |
| 7 colour | ‘7CLR’ | 37434C52h |
| 8 colour | ‘8CLR’ | 38434C52h |
| 9 colour | ‘9CLR’ | 39434C52h |
| 10 colour | ‘ACLR’ | 41434C52h |
| 11 colour | ‘BCLR’ | 42434C52h |
| 12 colour | ‘CCLR’ | 43434C52h |
| 13 colour | ‘DCLR’ | 44434C52h |
| 14 colour | ‘ECLR’ | 45434C52h |
| 15 colour | ‘FCLR’ | 46434C52h |
ICC.1:2022 © ICC 2022 – All rights reserved
ICC.1:2022 is the current version: https://www.color.org/icc_specs2.xalter
“Signature” is the value which must be saved to sys_file_metadata.color_space. (Trimming avoids roundtrip issues with VARCHAR columns which are auto-trimmed by some databases in some collations.)
The correct values for sys_file_metadata.color_space must therefore be defined as:
[
['label' => 'filemetadata.db:sys_file_metadata.color_space.XYZ', 'value' => 'XYZ'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.Lab', 'value' => 'Lab'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.Luv', 'value' => 'Luv'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.YCbr', 'value' => 'YCbr'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.Yxy', 'value' => 'Yxy'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.RGB', 'value' => 'RGB'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.GRAY', 'value' => 'GRAY'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.HSV', 'value' => 'HSV'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.HLS', 'value' => 'HLS'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.CMYK', 'value' => 'CMYK'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.CMY', 'value' => 'CMY'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.2CLR', 'value' => '2CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.3CLR', 'value' => '3CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.4CLR', 'value' => '4CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.5CLR', 'value' => '5CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.6CLR', 'value' => '6CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.7CLR', 'value' => '7CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.8CLR', 'value' => '8CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.9CLR', 'value' => '9CLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.ACLR', 'value' => 'ACLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.BCLR', 'value' => 'BCLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.CCLR', 'value' => 'CCLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.DCLR', 'value' => 'DCLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.ECLR', 'value' => 'ECLR'],
['label' => 'filemetadata.db:sys_file_metadata.color_space.FCLR', 'value' => 'FCLR'],
]
dbFieldLength remains unchanged at 4.
The corresponding language labels must be:
<trans-unit id="sys_file_metadata.color_space.XYZ">
<source>nCIEXYZ or PCSXYZ</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.Lab">
<source>CIELAB or PCSLAB</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.Luv">
<source>CIELUV</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.YCbr">
<source>YCbCr</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.Yxy">
<source>CIEYxy</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.RGB">
<source>RGB</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.GRAY">
<source>Gray</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.HSV">
<source>HSV</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.HLS">
<source>HLS</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.CMYK">
<source>CMYK</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.CMY">
<source>CMY</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.2CLR">
<source>2 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.3CLR">
<source>3 colour (other than those listed above)</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.4CLR">
<source>4 colour (other than CMYK)</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.5CLR">
<source>5 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.6CLR">
<source>6 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.7CLR">
<source>7 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.8CLR">
<source>8 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.9CLR">
<source>9 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.ACLR">
<source>10 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.BCLR">
<source>11 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.CCLR">
<source>12 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.DCLR">
<source>13 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.ECLR">
<source>14 colour</source>
</trans-unit>
<trans-unit id="sys_file_metadata.color_space.FCLR">
<source>15 colour</source>
</trans-unit>
Migrations:
- grey is migrated to the correct GRAY.
- YUV is migrated to the correct YCbr.
- indx (indexed color) is removed, as it is a storage encoding, not an ICC color space signature. This was a misconception in DAM, conflating color mode/encoding and color space.
- sRGB equally is not an ICC color space signature; it was introduced to work around incorrect assumptions in EXT:extractor and must be fixed there.
Side note regarding indx and color mode conflation:
A separate sys_file_metadata.color_mode could be introduced, but that is out of scope of this bug report, which only aims at cleaning up the cargo cult of incorrect color space definitions, and finally allowing clean mapping from image files’ ColorSpaceData field to sys_file_metadata.color_space, without conflation of concepts.
Side note regarding sRGB:
The legacy and mostly obsolete EXIF ColorSpace tag describes either ICC RGB (tagged “sRGB”, “Adobe RGB”, “Wide Gamut RGB”) or none (tagged “Uncalibrated”). The tag has been superseded by ICC profile embeddings.
Notably, extracting the ICC profile description tag, such as “sRGB IEC61966-2.1” or “Adobe RGB (1998)” is out of scope. If it were in scope, then the obsolete EXIF ColorSpace tag would translate into that additional image file metadata field.
Reviews 1
History 34
-
Leonie Philine commented <span data-processor="relativetime" data-value="2026-04-17T16:15:56+00:00" > 04/17/26, 16:15 </span>
Switching from
selectSingletoinputis certainly one way to fix it, and without any need for migrations. It could even be included in a patch update. -
Benni Mack changed Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2026-08-06T16:02:55+00:00" > 08/06/26, 16:02 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 95142 status
NewUnder Review <span data-processor="relativetime" data-value="2026-08-06T20:30:46+00:00" > 08/06/26, 20:30 </span>
thanks for the detailed report. what about switching to input type instead of select?