Bug 269669 - Unpremultiplied alpha workflow with canvas and transferFromImageBitmap is incorrect
Summary: Unpremultiplied alpha workflow with canvas and transferFromImageBitmap is inc...
Status: RESOLVED DUPLICATE of bug 200026
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 17
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: https://unpremultiplied-readback.glit...
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2024-02-18 07:00 PST by Felix Herbst
Modified: 2024-03-05 20:49 PST (History)
4 users (show)

See Also:


Attachments
Safari readback result (54.84 KB, image/png)
2024-02-18 07:00 PST, Felix Herbst
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Herbst 2024-02-18 07:00:35 PST
Created attachment 469951 [details]
Safari readback result

When using transferImageBitmap on a bitmaprenderer canvas context, and then converting that to PNG, the premultipliedAlpha: none flag is not respected.
Instead, the resulting image has garbled RGB data.

The behavior is correct in Chrome. The behavior is wrong in all WebKit implementations I tested.

Reproduction page: 
https://unpremultiplied-readback.glitch.me/

- Click "Download original" below.
- Then, click "Download readback".

You'll get 2 PNG files – their content should be identical. To check,

- open them in Photopea (photopea.com) or another app that allows seeing the RGB channel independent from the Alpha channel
- select Layer / Raster Mask / From Transparency
- slect Layer / Raster Mask / Delete

The results should be identical! There should be a cat in each of them, no weird pixels.
Comment 1 Radar WebKit Bug Importer 2024-02-25 07:01:38 PST
<rdar://problem/123595818>
Comment 2 Karl Dubost 2024-03-05 20:49:27 PST
Felix, thanks for the report!
This is a duplicate of Bug 200026

*** This bug has been marked as a duplicate of bug 200026 ***