views:

407

answers:

1

Hi all,

Is there any useful way to load DIB into inputstream and get a handle to it and all that in JavaScript (js) ?

+1  A: 

Assuming DIB means Device Independent Bitmap...

If the DIB is on the client side in a browser, then I don't think you can do this with just the JS in the browser. You would need some java or flash or something else, because javascript in the browser has no way to read stuff from the filesystem.

If the DIB is on the server, you can use an ajax request to fetch it. In the callback, copy the returned data into an object where you can then manipulate the data as needed.

Once you are done manipulating the image data, you can use a canvas or an img tag to display it.

http://developer.mozilla.org/en/Canvas_tutorial/Using_images

I hadn't tried this until I saw your question, but an img tag with a data url is pretty interesting. Using the data url in the img src doesn't work in IE, but it does in FF and Opera. IE doesn't have a canvas tag, but they do have something similar. Some smart guys at google wrote a javascript library to enable the canvas tag in IE by translating into something IE understands.

http://code.google.com/p/explorercanvas/

I hope this helps. If not, maybe it is at least interesting.

Mnebuerquo