Closed Bug 1862245 Opened 2 years ago Closed 1 year ago

support cICP in PNG

Categories

(Core :: Graphics: ImageLib, defect)

Firefox 120
x86_64
Windows 10
defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox120 --- wontfix
firefox136 --- fixed

People

(Reporter: chris, Assigned: tnikkel)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

Run http://wpt.live/png/cicp-chunk.html

Actual results:

Fail

Expected results:

Pass

Chrome and Edge pass, Firefox and Safari fail

Several image formats such as AVIF and JPEG-XL use Coding Independent Code Points to label the colorspace of an image in only a few bytes, compared to 100 bytes or more for an ICC Profile. I see Firefox already has CICP support for AVIF
https://bugzilla.mozilla.org/show_bug.cgi?id=1723253

PNG Third Edition added a cICP chunk for this too.
https://w3c.github.io/PNG-spec/#cICP-chunk

Here is the relevant section of the Explainer we did for TAG review
https://github.com/w3c/PNG-spec/blob/main/Third_Edition_Explainer.md#hdr-support

In addition to labelling HDR images it also compactly labels the increasingly popular Display P3 colorspace, and BT.2020 which is common in screenshots from broadcast video content.

Content providers are awaiting interoperable cross-browser support to start using it in PNG images on the Web. It is implemented in Adobe Photoshop and in Darktable.

The referenced WPT is the first of several tests for cICP in PNG, and uses Display P3.

Put link from description on Win11x64 using FF build 120.0b4 and it failed, while on Chrome passed.
Marking issue as new, not sure if component is correct please update if otherwise. This issue is similar to bug 1862235 in case they are related. Thank you.

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → Top Sites
Ever confirmed: true
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

The severity field is not set for this bug.
:jteow, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jteow)
Component: Top Sites → Graphics
Flags: needinfo?(jteow)
Product: Firefox → Core
Component: Graphics → Graphics: ImageLib

The severity field is not set for this bug.
:tnikkel, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(tnikkel)
Severity: -- → S3
Flags: needinfo?(tnikkel)

WPT test results for cICP in PNG shows passes in Chrome and in Edge. Safari is shown as failing, because it relies on macOS support and the version of macOS used on WPT is too old. It passes in local testing on macOS Sonoma.

Thus, the only browser now failing is Firefox.

There is another WPT, which checks that cICP correctly sets the colorspace for all frames of an animated PNG. This is passed by Chrome (and Edge)

https://wpt.fyi/results/png/apng/fDAT-inherits-cICP.html?label=experimental&label=master&aligned

Jon Bauman [:jbauman:] I see you did the CICP support for AVIF, would similar code also with for CICP in PNG?

I'm aware that some big industry players are waiting for universal cross-browser support before deploying, and this currently works in Blink and WebKit.

WPT test results for cICP in PNG now shows passes in Chrome, Edge and Safari; WPT updated the version of macOS used for testing.

Most recent libpng update included native support for this so we don't need to fiddle with unknown chunks.

Assignee: nobody → tnikkel
Status: NEW → ASSIGNED
Pushed by tnikkel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8599fc020cd6 Support cICP colorspace chunk in png files. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch

Great to see this landing.

In case it helps with testing, I made an updated version of pngcheck which supports cICP:

https://github.com/svgeesus/pngcheck

Regressions: 1943390

Nightly 136.0a1 (2025-01-24) (64-bit) is still failing cICP tests like https://wpt.live/png/cicp-chunk.html is that expected?

Regressions: 1943715

(In reply to chris from comment #13)

Nightly 136.0a1 (2025-01-24) (64-bit) is still failing cICP tests like https://wpt.live/png/cicp-chunk.html is that expected?

That is not expected since that test is run in our CI and it looks to be passing. Also I just https://wpt.live/png/cicp-chunk.html and it fails in Firefox beta (which does not have this fix) but passes in latest Nightly (which does have this fix). I checked on a mac and a Windows machine. So maybe it's something different about your machine? Perhaps the color profile?

My earlier comment was in relation to the published wpt results (from 24 Jan). On 26 Jan these turned to passes for Firefox.

The test does still fail on my machine (which has a wide gamut screen; the WPT infrastructure is limited to sRGB).

(In reply to chris from comment #15)

My earlier comment was in relation to the published wpt results (from 24 Jan). On 26 Jan these turned to passes for Firefox.

The test does still fail on my machine (which has a wide gamut screen; the WPT infrastructure is limited to sRGB).

The same test passes on the same machine, in Chrome Canary Version 134.0.6982.0 (Official Build) canary (64-bit). It is a Windows machine, so I can't run Safari on it.

Regressions: 1960856
Summary: PNG with cICP colorspace labeling display incorrectly → support cICP in PNG
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: