Feature #830
Updated by Jörg Riesmeier over 7 years ago
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. When converting a color JPEG image to DICOM, img2dcm dcm2img currently assumes that this uses YCbCr color model, which causes an incorrect image to be created when an RGB JPEG image is used. 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. img2dcm dcm2img should specifically look for these component identifiers, and if found, assume an RGB encoding (i.e. set PhotometricInterpretation to "RGB"). Attached is an example of a JPEG image with RGB encoding.