# Convert Tex File into an image [duplicate]

I would like to know what do I have to do if I want to convert the my Tex document into an image. I'm new to Latex World, sorry if it is a dumb question for somebody

## marked as duplicate by Werner, egreg, OSjerick, Mensch, GuidoSep 15 '14 at 20:41

• Hi and welcome to TeX.SX. To clarify, do you mean an image or do you mean compile the document to a the final output? – Johannes_B Sep 15 '14 at 18:08
• if you mean "image" such that it can be embedded into another document, is the document you want to convert just one page, or multiple pages? – barbara beeton Sep 15 '14 at 18:10
• I mean an image. Right know when I compile the code I get some files inluding a pdf document. My intention is to transform the text document into an image in order to copy it to Word. – Jordi Bosch Sep 15 '14 at 18:10
• I mean just one page. – Jordi Bosch Sep 15 '14 at 18:13
• Perhaps tex.stackexchange.com/q/11866/17423 helps? – Sean Allred Sep 15 '14 at 18:17

I don't have enough points to comment but what exactly you are talking about? You want to convert a 1 page Tex document to image? Simply you can build as pdf and then convert pdf to images with many free tools.

• Okey but I heard there is an easier method using directly the latex compiler to transform it into an image – Jordi Bosch Sep 15 '14 at 18:12
• Check here then. You can do that in the \documentclass – Odin Sep 15 '14 at 18:16
• If it's one page .pdf document, you can include it anyway as image or using pdfpages package anyway. There is no need to convert to another image format again – user31729 Sep 15 '14 at 19:14

You must have ImageMagick installed. The following simulates everything you need to generated images from your TeX input file.

% filename.tex
% compile it with
% pdflatex -shell-escape filename.tex

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents*}{main.tex}
\documentclass[12pt]{article}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
\end{filecontents*}

\immediate\write18{pdflatex main.tex}
\makeatletter
\immediate\write18{convert -density 100 main.pdf main-\@percentchar d.png }
\makeatother

\usepackage{animate}
\begin{document}
\animategraphics[autoplay,loop,scale=0.5,controls]{5}{main-}{0}{19}
\end{document}