I’m wondering if it’s possible to get the blob data (like base64 encoded or something) of an image that’s already loaded, via javascript?
The use case would be that I get a captcha image from a webpage into an android app.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You may be able to use getImageData from the Canvas API. See https://developer.mozilla.org/En/HTML/Canvas/Pixel_manipulation_with_canvas for example. So you can create a canvas, render the image onto it, and then use getImageData on the canvas to get the pixels.
One obstacle to this, though, is the same origin policy. If the image that you’re parsing comes from the same domain as your JavaScript, I think you’re fine, but if the image comes from an external source, getImageData is going to fail due to the same origin policy.