Feature #829
openJPEG decoder should use JPEG component identifiers to guess the color model used
0%
Description
Most color JPEG images internally use the YCbCr color model. Unfortunately,
in rare cases also JPEG baseline compressed color images that use RGB
can be encountered, and DCMTK currently by default assumes that these are
YBR_FULL and performs a color space conversion upon decompression, leading
to an incorrect display.
According to information received from Dave Harvey, these rare RGB images
which were produced by some Adobe tools can be recognized by the
"ComponentIdentifier" numbers in the JPEG_SOF parameters. Normally these
identifiers, which are arbitrary bytes, have the values 0, 1 and 2.
In the case of Adobe RGB images, however, they always use the numbers
82, 71 and 66, which are the ASCII codes for "R", "G" and "B", as hints
that this is really RGB data.
Our JPEG decoder should specifically look for these component identifiers,
and if found, assume an RGB encoding.
Attached is an example of a JPEG image with RGB encoding, with and without DICOM "wrapper".
Files