Test Setup

The test file contains RGB pixels of a cat, and A (alpha) pixels that are near-zero.
The test is to load the image, run it through createImageBitmap and a canvas that is set to premultiplyAlpha: "none", and export it back out as PNG.
This should result in the same data, without any multiplications or divisions by alpha.

  1. Click "Download original" below.
  2. Then, click "Download readback".
You'll get 2 PNG files – their content should be identical. To check,
  1. open them in Photopea
  2. select Layer / Raster Mask / From Transparency
  3. slect Layer / Raster Mask / Delete
The results should be identical! There should be a cat in each of them, no weird pixels.

Browser Results

As far as I can tell Chrome is the only browser here that correctly returns an unpremultiplied result with RGB pixels intact.

Using a Javascript PNG encoder instead of transferFromImageBitmap/toDataURL results in correct data – some canvas implementation(s) don't seem to fully respect the premultiplied option.

Chrome

RGB readback works as expected! The canvas itself looks wrong though (uses alpha despite being configured without alpha).

Safari

WebKit Bug Report

Firefox

Mozilla Bug Report

HTML Spec

Not entirely sure what the correct way to configure this as the spec doesn't explicitly note how transferFromImageBitmap and premultiplyAlpha: "none" interact.
WhatWG HTML Spec Issue

By Felix Herbst, Needle