[Tex/LaTex] Add tif image to LaTeX

graphicstiff

I have to add .tif graphic in my LaTeX file, but it is not working.

\usepackage{graphicx}

\begin{figure}[h]
    \begin{center}
       \includegraphics[width=15mm]{myGraphic.tif}
    \end{center}
\end{figure}

After some research, .tif files won't work in pdfLaTeX or something. But I need to have my figure with .tif extension (not .jpg or others). How can I add .tif figure in my .tex file?

Best Answer

No LaTeX engine can read .tif files directly: you will have to convert to another format (more on the graphics formats recognised by TeX is in Which graphics formats can be included in documents processed by latex or pdflatex?). Probably the easiest route is to use pdfLaTeX with the graphics converted to .png format. This conversion is lossless and therefore the images will be identical.

You can do this by hand, but it is also possible to set up to do the job automatically. The method is discussed in Using macros in \DeclareGraphicsRule statement using shell command: the basic requirement is something like

\def\eattif#1.tif{#1}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 \eattif#1-tif-converted-to.png }
\AppendGraphicsExtensions{.tif}

in your preamble to enable the conversion. This requires that the convert program is available and needs shell escape enabled.

You can use a perhaps clearer syntax by loading the package epstopdf:

\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.tif}{png}{.png}{convert #1 \OutputFile}
\AppendGraphicsExtensions{.tif}

can substitute the three lines of code above.