ImageSharp 4.1.3 misclassifies linear RGB ICC profiles as sRGB
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- C#
- スター
- 8k
- フォーク
- 904
- 平均マージ
- 15時間 39分
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SixLabors/ImageSharp のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
SixLabors/ImageSharp#3218 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 30/100
SixLabors/ImageSharp#3215 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement metadata:icc
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
SixLabors/ImageSharp#3198 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug metadata:icc
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
SixLabors/ImageSharp#3197 ·
メンテナーはふだん 1 日以内に返信
-
formats:exr
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
SixLabors/ImageSharp#3116 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
SixLabors/ImageSharp の issue をすべて見る
似ている issue
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 62/100
-
bug misleading tooling trivial
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Docs example projects pinned to a literal library version instead of 3.*対応中かも @DaveSkender が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
facioquo/stock-indicators-dotnet#2372 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] officecli-docx SKILL.md still describes `\n` as a soft line break after #262対応中かも @giprime が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Facepunch/sbox-public#12097 ·
メンテナーはふだん 2 日以内に返信