ImageSharp 4.1.3 misclassifies linear RGB ICC profiles as sRGB
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
The suspected cause is IsCanonicalSrgbMatrixTrc() in src/ImageSharp/Metadata/Profiles/ICC/IccProfile.SRGB.cs, which compares the red, green and blue curves but not whether they are the sRGB transfer function. Start with the reproduction ZIP linked in the issue and run it in both DEBUG and RELEASE to see the four failing assertions. Done means linear gamma=1 profiles are not classed as sRGB, Convert produces the expected pixel values, and Compact keeps the profile.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Ubuntu WSL2, Linux x64, .NET SDK 10.0.112
.NET Framework version
.NET 10.0.12
Description
ImageSharp 4.1.3 incorrectly classifies certain linear RGB ICC profiles as canonical sRGB.
When decoding JPEG or PNG images containing a linear RGB ICC profile with sRGB primaries and gamma=1, ColorProfileHandling.Convert removes the ICC profile without converting the pixel values to sRGB.
PNG:
Actual RGB: [32,64,128]
Expected sRGB: [99,137,188]
JPEG:
Actual RGB: [40,80,120]
Expected sRGB: [110,152,182]
The expected values were independently verified using Little CMS 2.17.
ColorProfileHandling.Compact also incorrectly removes the non-sRGB ICC profile while leaving the RGB values unchanged.
The defect occurs immediately after Image.Load returns, before orientation correction, metadata removal or output encoding.
The issue reproduces identically in both DEBUG and RELEASE configurations with .NET 10.
Suspected cause:
The IsCanonicalSrgbMatrixTrc() method checks that the red, green and blue tone reproduction curves match, but does not verify that they implement the actual sRGB transfer function. Therefore, identical linear gamma=1 curves may be incorrectly classified as canonical sRGB.
Impact:
This defect can cause incorrect photographic colors when an ICC profile is removed without performing the necessary color transformation.
Could the maintainers confirm this issue and advise whether a fix or officially supported workaround is available for ImageSharp 4.1.x?
Steps to Reproduce
Steps to reproduce:
-
Use SixLabors.ImageSharp 4.1.3 with .NET 10 on Linux x64 (Ubuntu WSL2).
-
Extract the attached reproduction ZIP into a clean directory and follow its README instructions. Use a valid Six Labors license stored outside the project.
-
Restore the locked NuGet dependencies and compile the reproduction project.
-
Run the reproduction in both DEBUG and RELEASE configurations.
-
The supplied synthetic JPEG and PNG images contain an ICC v4.3 RGB profile with sRGB primaries and linear gamma=1 transfer curves.
-
Load the images using Image.Load with ColorProfileHandling.Convert, Compact and Preserve.
-
Inspect the RGB pixel values and ICC profile immediately after decoding.
-
Compare the results against the expected sRGB values independently verified using Little CMS 2.17.
Expected versus actual results:
PNG Convert:
Expected RGB: [99,137,188]
Actual RGB: [32,64,128]
ICC: Absent in both cases.
JPEG Convert:
Expected RGB: [110,152,182]
Actual RGB: [40,80,120]
ICC: Absent in both cases.
PNG Compact:
Expected RGB: [32,64,128]
Actual RGB: [32,64,128]
Expected ICC: Present
Actual ICC: Absent
JPEG Compact:
Expected RGB: [40,80,120]
Actual RGB: [40,80,120]
Expected ICC: Present
Actual ICC: Absent
Verification:
The defect reproduces identically in DEBUG and RELEASE.
Two Preserve control assertions pass.
Four assertions fail.
Exit code 1 is intentional because the tests detect the defect.
The problem occurs immediately after Image.Load returns, before orientation correction, metadata removal or PNG encoding.
The attached ZIP contains the minimal .NET 10 project, synthetic JPEG/PNG/ICC fixtures, instructions, expected results and SHA-256 hashes.
No license credentials, customer images or proprietary code are included.
Images
- Ngôn ngữ chính
- C#
- Star
- 8k
- Fork
- 904
- Merge trung bình
- 15 giờ 39 phút
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SixLabors/ImageSharp
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
SixLabors/ImageSharp#3218 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 30/100
SixLabors/ImageSharp#3215 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement metadata:icc
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SixLabors/ImageSharp#3198 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Grayscale Icc profile colorĐang mởbug metadata:icc
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
SixLabors/ImageSharp#3197 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
formats:exr
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
SixLabors/ImageSharp#3116 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SixLabors/ImageSharp
Issue tương tự
-
:watch: Not Triaged async-task-programming/subsvc dotnet-csharp/svc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parseCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14590 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Needs-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
PowerShell/PowerShell#28194 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AI Projects Client customer-reported needs-team-attention question Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Azure/azure-sdk-for-net#63804 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày