Hi,

I think I found a solution to save images from the applet without the
need of a server.
The solution is supposed to work at least for most current non-'Internet
Explorer' browsers.

The idea is quite simple:

1) the javascript Jmol interface requests an image from Jmol
2) Jmol returns the image data to the interface
3) the image is inserted as value into the HTML code of the page for a
(predefined?) object
4) the browser displays the image in the page
5) the user saves the image using the "Save image..." dialog

I have set up a little demonstration page that illustrates this technique:
http://www.fli-leibniz.de/ImgLibPDB/pages/embedded_image_demo.html

I had this idea already a while ago but didn't know how to display image
data without a file. The tip from the following URL,
"http://www.lsc.ufsc.br/~luizd/base64-to-mhtml/workaround.html";,
provided the solution.

The problem with 'Internet Explorer' is, that the demo page uses a
base64 encoded image and (of course) IE seems to be the only current
browser that doesn't decode base64 images.

But I think for saving images from Jmol it should not be necessary to
use base64 encoding. Since the data is integrated as value directly with
javascript into the object, I would expect that special characters will
not be a problem.

I  havn't found out yet how to specify the image data without base64
encoding, but it might just be:

"data='data:image/gif;...'"
instead of
"data='data:image/gif;base64,...'"

(the '...' represent the image data)

I couldn't test if this really works because I  had no idea yet how to
get the image data into a javascript variable without Jmol providing it.

This method should at least work with other browsers, if Jmol would do a
base64 encoding of the image.

It would be best, if the resolution of the provided image could be set
independant from the size of the applet.

Regards,
Rolf

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to