Portable library to render 2D structural formulas as vector graphics from SMILES or InChI For a web-based project, I am looking for a piece of software to create a 2D vector graphics structural formula from a textual structure encoding scheme such as SMILES or InChI, running on the server or client, and callable via some kind of API.

I’m imagining a client- or server-side library that you could just use like this:

svg_output = lib.render_from_smiles(smiles_input);


Ideally, it would have the following properties:


Take a SMILES or InChI representation of the compound as input
Compute the structure graph and 2D positional data (positions of atoms, types of bonds, etc.)
Render the structure in some kind of vector graphics representation (SVG would be perfect, but any other open format would do)
Or, alternatively, just output the computed drawing parameters, to be passed on to a separate renderer (which would need to be written, but that is the less challenging part)
Written in a language that is easy to use and deploy in web environments (PHP, JavaScript, Python, Ruby, Go, etc.)
If a renderer is included, allow me to control the rendering style (stroke width/colours, text attributes etc.)
Open source or with license terms that are affordable to a non-profit project :)


The application just needs to render individual structures. No reaction mechanisms or anything fancy. Small organic molecules only.

I know there are various standalone software packages (ChemDraw, MarvinSketch etc.) that do this kind of thing, but I did not find anything that can be used as a library like this.

Any suggestions or ideas? Thank you!
You might want to have a look at Open Babel.


It is licensed under GNU GPLv2  
It has bindings for Python
It has bindings for PHP
It has bindings for Ruby
It can read (and write) SMILES
It can read (and write) InChI
It   can write SVG
It can write a list of painter commands