The way I do it is using the ImageMagick utility convert:
pdflatex myfile
convert -density 150 myfile.pdf myfile.png
You can of course make a shell script for that (in linux in the following way, in windows it can be done as well but I don't know how): Make a file pnglatex in your /usr/bin directory with contents
#!/bin/bash
f=${1%.tex}
pdflatex $1 &&
echo Converting: &&
convert -density 150 $f.pdf $f.png
Then you can run pnglatex myfile or pnglatex myfile.tex. You can of course choose any common image format, but PNG is probably most suitable (see comments).
standaloneclass which has a image convert feature (starting from v1.0). However, you always need to compile it to DVI/PS or, better, PDF and then convert it from there.standalonejust does most of that for you. See the question linked by @AndrewStacey above for details. Your question seems to be a close duplicate of that one. If you don't think so please add more details into your question, e.g. your motivation etc., so that the the difference can be seen better. Similar, more specific and/or follow-up questions of existing ones are fully acceptable here. – Martin Scharrer Mar 16 '12 at 12:28