While png format does indeed store the "non-premutlipied" alpha, CanvasRenderingContext2D on the other hand always do pre-multiply alpha.
So what you are after can not be done from a CanvasRenderingContext2D.
Indeed, since the alpha gets pre-multiplied at writing, if you do write an #AABBCC00
(transparent) pixel over your context, what will be drawn will actually be #00000000
.
Also, because of how binary floating points work, you can not be sure to have the same output in different browsers/devices, even with non-zero alpha values:
// demonstrates alpha premultiplying at writing on a canvas 2d context
//
// 4 pixels are authored with the same RGB channels values but with different alpha values
// If no pre-multiplying was done, all these would output the same RGB channels values at getting
var ctx = document.createElement('canvas').getContext('2d'),
img = ctx.createImageData(4,1),
// we use an Uint32Array to write every pixel in a single op
arr = new Uint32Array(img.data.buffer);
// AARRGGBB in little endian
arr[0] = 0x00AABBCC; // transparent (alpha 0)
arr[1] = 0x01AABBCC; // almost-transparent (alpha 1/255)
arr[2] = 0x7FAABBCC; // semi-transparent (alpha 0.5/1)
arr[3] = 0xFFAABBCC; // opaque
// write it to our context
ctx.putImageData(img, 0,0);
// grab it directly
var result = ctx.getImageData(0,0,4,1).data;
console.log('transparent', result.slice(0,4));
// outputs [0, 0, 0, 0]
console.log('almost-transparent', result.slice(4,8));
// outputs something like [255, 255, 255, 1]
console.log('semi-transparent', result.slice(8,12));
// outputs something around [204, 187, 170, 127]
// on my FF it is [204, 188, 170, 127]
// on my chrome it is [205, 187, 171, 127]
console.log('opaque', result.slice(12,16));
// outputs [204, 187, 171, 125]
As you can see, only full opaque pixels keep their initial RGB channels' values.
So to do what you want, you would have to actually parse manually the png file, and extract the data contained in the IDAT chunks manually.
To do it one the front-side, you'd load your file as an ArrayBuffer and parse it following these specs.
But before you start writing your parser, you'd have to consider how likely it is that 100% of your users actually used a lossless software that would preserve the RGB channels' values (unlike the canvas).