how to convert image into bytes (like byte array in .Net) using javascript in Palm WebOS

2.6k views Asked by At

In Palm WebOs I need to convert an image into bytes (like byte array in .Net) to pass it as a parameter to a web service, where I can convert back this bytes data to image and save on server. Please help me to convert image into string variable or any other format to send it to the web service using javascript or jquery in palm webos. Thanks,

1

There are 1 answers

0
nemisj On

If javascript engine supports canvas elements you can try to use canvas element and getImageData to fetch the pixel data from your image. Then, depending on type of the image you could create the binary representation of this image.

Here is info about canvas element and getImagedata api: http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-getimagedata