CMYK JPEG with embedded SWOP profile decodes with lifted dark colors: decoder does not apply black point compensation (differs from Photoshop/ImageMagick)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 50/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- csharp
- Domaine
- computer-graphics
Piste de recherche
Start by reading DecoderOptions, the JPEG decoder's ICC profile conversion path, and ColorConversionOptions.UseBlackPointCompensation/ColorProfileConverter. Check existing JPEG decoding and color-profile tests to find where decoder options are applied. Done means decoding this CMYK/YCCK JPEG can use BPC and produces results consistent with the reported BPC reference values.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
4.1.3 and 5.0.0-alpha.0.29 (nightly, build bce6d79 )
Other ImageSharp packages and versions
none
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
.NET 10.0
Description
Decoding a CMYK (YCCK) JPEG that embeds "U.S. Web Coated (SWOP) v2" produces colors that differ from Photoshop and ImageMagick. Dark colors are noticeably lighter. For example, a near-black charcoal background decodes as RGB (50, 51, 51), where ImageMagick with black point compensation (BPC) gives (25, 28, 28).
The cause is that the decoder converts without BPC. ColorConversionOptions.UseBlackPointCompensation exists in 5.0.0-alpha.0.29 and gives the correct result through ColorProfileConverter , but the JPEG decoder doesn't use it and DecoderOptions doesn't expose it. The result is that the same file looks different in ImageSharp than in Photoshop, ImageMagick or other color-managed viewers.
The 5.0 nightly is a big improvement over 4.x. On 4.1.3 the default Preserve ignores the profile (colors are oversaturated), and Convert gives a bluish charcoal (57, 67, 72). This report is about the remaining difference.
Expected: a way to decode with BPC, or a decoding result that matches the Photoshop and ImageMagick conversion.
Actual: the decoder always gives the non-BPC result.
Steps to Reproduce
ImageMagick reference:
magick cmyk_swop_exact.jpg -intent relative -black-point-compensation -profile sRGB.icm out.bmp
The test image is a 1200x800 YCCK JPEG at quality 100, with no chroma subsampling. Each block is an exact CMYK ink value, so the expected values are unambiguous.
Results (sRGB)
Sample ink values (C/M/Y/K %):
| Area | Ink C/M/Y/K % |
|---|---|
| Red | 0/100/100/0 |
| Blue | 100/100/0/0 |
| Green | 100/0/100/50 |
| Charcoal | 70/60/60/80 |
| Orange | 0/45/80/0 |
ImageSharp 4.1.3 (stable)
| Area | Preserve (default) |
Convert |
|---|---|---|
| Red | 255, 0, 0 | 237, 51, 56 |
| Blue | 0, 0, 255 | 62, 64, 150 |
| Green | 0, 128, 1 | 0, 108, 63 |
| Charcoal | 16, 20, 20 | 57, 67, 72 |
| Orange | 255, 140, 51 | 248, 160, 82 |
ImageSharp 5.0.0-alpha.0.29 (nightly)
| Area | Decoder (no BPC option) | ColorProfileConverter, BPC off |
ColorProfileConverter, BPC on |
|---|---|---|---|
| Red | 238, 51, 56 | 238, 51, 56 | 237, 28, 36 |
| Blue | 63, 64, 150 | 63, 64, 150 | 46, 48, 146 |
| Green | 0, 108, 63 | 0, 108, 62 | 0, 101, 46 |
| Charcoal | 50, 51, 51 | 49, 51, 51 | 24, 28, 28 |
| Orange | 249, 160, 83 | 249, 161, 84 | 249, 158, 73 |
ImageMagick reference
| Area | ICC, no BPC | ICC + BPC |
|---|---|---|
| Red | 238, 51, 56 | 237, 28, 36 |
| Blue | 63, 64, 150 | 46, 48, 146 |
| Green | 0, 108, 63 | 0, 101, 46 |
| Charcoal | 50, 51, 51 | 25, 28, 28 |
| Orange | 249, 160, 84 | 249, 157, 73 |
Images
cmyk_swop_exact_imagesharp_nightly29.bmp
cmyk_swop_exact_imagesharp_Convert.bmp
cmyk_swop_exact_imagesharp_Preserve.bmp
cmyk_swop_exact_imagemagick.bmp
- Langage dominant
- C#
- Étoiles
- 8.1k
- Forks
- 913
- Merge moyen
- 1 j 30 min
- PR mergées (30 j)
- 29
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de SixLabors/ImageSharp
-
formats:exr
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
SixLabors/ImageSharp#3116 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
JpegImageFormatDetector IsJfif and IsExif checks are not needed as IsJpeg is always true for valid JPEG files.Peut-être pris @EnesKartal l’a pris il y a 5 jours. Ouverteneeds triage
Difficulté 2/5 1-3 heures Accessibilité débutants 52/100
SixLabors/ImageSharp#2805 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
CR2: System.NotSupportedException: Missing SOI marker offset for tiff with old jpeg compressionOuverteneeds triage
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
SixLabors/ImageSharp#2665 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
test-bug
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
SixLabors/ImageSharp#2158 · 6 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
needs triage unit tests
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
SixLabors/ImageSharp#1550 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de SixLabors/ImageSharp
Issues similaires
-
agentic-workflows
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
dotnet/maui#40788 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
erkamyaman/rust-anything#943 ·
Les mainteneurs répondent en général sous 1 jour
-
priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
SixLabors/ImageSharp.Drawing#438 · 1 commentaire ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100