简体   繁体   中英

Image mask using dataurl

I am wanting to take an image that I created by changing pixel data and use it as a mask. I guess the big question is how can I turn a dataUrl into an image so I can use it ask a mask. As I see it the dataurl is a base64 image. I need to get the real image from the base64.

I am currently trying to use Ben Barnett Canvas Utility for the masking. I am open to using something else to mask with if it can use a dataUrl.

If I understand correctly, you have the base64 data for the image, and you need an Image object. All you need to do is:

var img = new Image();
img.src = dataurl;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM