Obtaining a image from MarvinSketch programmatically

User d68ef9d5a9

16-05-2011 13:45:40

Hi,


When a MarvinSketch is imbedded in an HTML page, I would like to obtain an image from the MarvinSketch that contains whatever user draws on the applet. I see the MarvinSketch provices a menu to save as image in png or jpg formats. I would like to programmtically (in Javascript) obtain the image file. Is it possible, and would you please point out some sources?


Another question is that how to programmatically to get image from a molfile? I remember I did that before, but forget how to do it. Thanks.


Ben Li

ChemAxon 0a9e2a55e1

16-05-2011 17:01:26

Hi,


You can read about our graphical formats, and their options here:


http://www.chemaxon.com/marvin/help/formats/formats.html


To get an image from a molfile, You can use the molconvert tool:


molconvert jpeg "inputfilname"


From API, if You have a molecule You can use the toBinFormat() function:


m.toBinFormat("jpeg")


You can read about this here too:


http://www.chemaxon.com/marvin/help/formats/images-doc.html


Here is an applet example how to import and export from/to Marvin applet via javascripts. You can check this applet examples:


http://www.chemaxon.com/marvin/examples/applets/sketch/js_io.html


http://www.chemaxon.com/ajax/


Best Regards,


Peter