Skip to content

[transfer-syntax-registry] Set Photometric Interpretation to YBR_FULL_422 when encoding JPEG Baseline - #830

Open
userepo wants to merge 2 commits into
Enet4:masterfrom
userepo:fix/829-jpeg-baseline-ybr-full-422
Open

userepo wants to merge 2 commits into
Enet4:masterfrom
userepo:fix/829-jpeg-baseline-ybr-full-422

Conversation

@userepo

@userepo userepo commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #829.

  • When encoding a 3-sample-per-pixel object to JPEG Baseline, the frame is handed to jpeg-encoder as ColorType::Rgb, which converts the samples to YCbCr and writes a JFIF stream. The attribute changes returned by encode_frame nevertheless asked for (0028,0004) Photometric Interpretation to be RGB. Request YBR_FULL_422 instead, since that is the color space of the encoded data.
  • RGB is not an invalid value here — Table 8.2.1-1 in PS3.5 Section 8.2.1 lists both YBR_FULL_422 and RGB for the 3-sample row of JPEG Baseline. What the same section does require is that the Data Elements describing the Pixel Data encoding be consistent with the characteristics of the compressed data stream, and a RGB tag over a YCbCr codestream is not.

@Enet4
Enet4 self-requested a review September 10, 2026 08:11
@Enet4 Enet4 added bug This is a bug A-lib Area: library C-transfer-syntax Crate: dicom-transfer-syntax-registry labels Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lib Area: library bug This is a bug C-transfer-syntax Crate: dicom-transfer-syntax-registry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JPEG Baseline encoder labels its YCbCr output PhotometricInterpretation = RGB

2 participants