Reputation: 920
Is it possible to edit (resize, flip, etc.) a base64 encoded image directly through javascript?
Upvotes: 2
Views: 4800
Reputation: 318302
Yes you can, once it is in the DOM structure it does not matter if it's base64 or an external image, you can manipulate like you would any other DOM element.
Using it as a background image (and then manipulating the holding element), directly in a img tag or inserting it with javascripts new image (and then create element img) does not matter, as long it is in the DOM.
You can convert your images online in one of the many converters, this one uses html5 only : base64img.com
Upvotes: 0
Reputation: 6703
Yes, it is possible using HTML5.
Just load the base64 string as image source <img src="data:image/png;base64,iVBORw0KGgo...
and then add it into canvas element (by using the drawImage
method of the canvas's context) and do whatever you want with it.
Upvotes: 4