tex -> png

I would like to use Matplotlib for automatically generating reports in HTML. I would like to do this without having to use latex first and the convert from there (it would be much faster to make my own HTML directly and I don't need lots of complicated features yet). Has anyone already done this who is willing to share code with me?

One thing I need to do that would make this work really well is to generate little PNG's of symbols and formulas to use in line with text in the HTML (sort of how LaTeX2HTML handles using $\theta$ in line. Is there a way to use the TeX rendering system used on figures to make little PNG's with just TeX expressions on them (i.e. theta.png)?