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.
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.
transferFromImageBitmap
and premultiplyAlpha: "none"
interact.