javascript - Accessing the <img> tag data -
I want to access the tag data so that I can use the JavaScript image processing to manipulate the server Can send to This is the & lt; Canvas & gt;
can be done with:
For canvas support in IE:
-
Create a canvas:
var canvas = document.createElement ('canvas'); Canvas.setAttribute ('width', 150);
canvas.SetAuthorBetter ('height', 150); -
Get 2D references:
var context = canvas.getContext ('2d');
-
Copy the image to the canvas:
context.drawImage (document.getElementById ('your_image_id'), 0,0);
-
Modify you as you want:
-
Get the data URL with:
canvas.toDataURL ()
That's it.
Also, see here:
Comments
Post a Comment