I would like to create a dataURL from an ImageData object (i.e. width, height, data). I realize canvas has this, but I want to avoid distortions canvas use has (alpha premultiply mainly) .. i.e. I want to avoid the obvious canvas.putImageData step.
From this post I can make any arraybuffer/typedarray/dataview into base64. What I dont know is how the canvas dataurl adds the width/height to the Uint8 data portion of the base64 string. Nor do I know how the png conversion is done. (I'd be OK with a raw data image type but I don't think there is one .. just png and jpg)
Possible approaches:
- Load ImageData into Canvas with putImageData. Fails, distorts data.
- Create an image with img.src = base64 data. Fails, has to be canvas dataurl.
- Other?
Anyone know how to construct an image dataURL from the raw width, height, data Imagedata?
from Convert an ImageData object (not a canvas) to image dataURL
No comments:
Post a Comment