Software or library for creating images of ball and stick models? Is there any code library (in any programming language) or software capable of producing images of ball and stick diagrams?

Example of an image of a ball-and-stick model for Ammonia:



(Image source)

Preferences:


It should be capable of producing images programmatically through a code library. Any mainstream programming language (C, Java, Python, etc.) is acceptable.
It should be able to take chemical descriptions as input to produce images of ball and stick diagrams as output.
It should be free and open source.


I know that it is possible to create these models using Mathematica's ChemicalData built-in symbol, but I am looking for something that can integrate better into my existing code base (hence the preference for free and open source libraries in mainstream programming languages).
For general open source solutions:


Avogadro - Molecular editor GUI. Has a Python API.
Jmol - Chemical structure viewer. Fully scriptable using a custom scripting language. It also has a JavaScript-only version named 'JSmol', allowing models to be displayed in web browsers.
ghemical - Has a GUI for editing molecules, but no API.


For a $\LaTeX$ solution, see this question on the $\TeX$ Stack Exchange site: Help creating solid cylinders along a path in Tikz for crystal lattice diagram

Other solutions:


If you have access to Mathematica (e.g. on a Raspberry Pi running Raspbian [which comes with a free copy of Mathematica]), you can use Mathematica's ChemicalData built-in symbol to create ball and stick models.