js获取image data

详: http://stackoverflow.com/questions/934012/get-image-data-in-javascript

You will need to create a canvas element with the correct dimensions and copy the image data with the drawImage function. Then you can use the toDataURL function to get a data: url that has the base-64 encoded image. Note that the image must be fully loaded, or you'll just get back an empty (black, transparent) image. It would be something like this. I've never written a Greasemonkey script, so you might need to adjust the code to run in that environment.

Getting a JPEG-formatted image doesn't work on older versions (around 3.5) of Firefox, so if you want to support that, you'll need to check the compatibility. If the encoding is not supported, it will default to "image/png".