You can obtain jpg or png files from latex source with the help of imagemagic. Consider this code:
\documentclass[tikz,convert,png={size=210,density=600}]{standalone}
\tikzset{
edge down and up again/.style={
to path={
|- ([shift={(\tikztotarget.south)}] +0pt,+-2.5mm) -- (\tikztotarget) }}}
\begin{document}
\begin{tikzpicture}
\node at (10, 10) (root) {root} ;
\node at (10, 7) (lvl1middle) {lvl1middle} ;
\node at (8, 6) (lvl2left) {lvl2left} ;
\node at (13, 5) (lvl2right) {lvl2right} ;
\node at (10, 5) (lvl2middle) {lvl2middle} ;
\path[edge down and up again] (root) edge [line to] (lvl1middle)
(lvl1middle) edge (lvl2left)
edge [line to] (lvl2middle)
(lvl2middle) edge (lvl2right);
\end{tikzpicture}
\end{document}
Save the above code as myfile.tex. Compile it with pdflatex with shell escape option. You should get a myfile.png file. For details consult standalone class documentation.
The above can also be achieved by following code that doesn't use standalone. Here demo.tex is your actual file whose contents are needed as image. This makes use of shell escape capabilities. :
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{demo.tex}
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}
\end{filecontents*}
%
%compile pdf first
\immediate\write18{pdflatex demo}
%
% convert to jpg
\makeatletter
\immediate\write18{convert -density 200 -alpha on demo.pdf demo-\@percentchar02d.jpg}
\makeatother
%
\begin{document}
Checkout the folder for image files.
\end{document}
You will get two files in the same directory - demo-00.jpg and demo-01.jpg with each page resulting in a jpg file.