Open Bug 1880753 Opened 4 months ago Updated 2 months ago

Unpremultiplied alpha workflow with canvas and transferFromImageBitmap is incorrect

Categories

(Core :: Graphics: Canvas2D, defect, P2)

Firefox 125
defect

Tracking

()

People

(Reporter: felix.herbst, Assigned: jgilbert, NeedInfo)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Steps to reproduce:

Using transferFromImageBitmap/toDataURL with correct settings for not using premultiplied alpha should allow correctly reading back the original RGB pixels. However, that is currently not possible in Firefox, but works as per the spec in Chrome.

Detailled steps, code, input/output results here:
https://unpremultiplied-readback.glitch.me/

Actual results:

The canvas PNG conversion step does not respect the premultipliedAlpha: "none" setting of the canvas. Instead, the resulting RGB pixels are garbled/contain what looks like random noise data mixed with a bit of retaining information.

Expected results:

Resulting PNG file should be the same/comparable RGBA data as original PNG file, without the RGB pixels being multiplied/divided by alpha.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core

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

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)
Severity: -- → S3
Flags: needinfo?(lsalzman) → needinfo?(aosmond)
Assignee: nobody → jgilbert
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: