74

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?

7
  • 4
    We hav a question yesterday asking much the same, which got marked as a duplicate of Which graphics formats can be included in documents processed by latex or pdflatex?. Bottom line: you have to convert your TIFF into another format.
    – Joseph Wright
    Jan 9, 2013 at 11:09
  • 6
    You should convert your file to PNG. There's no problem with this, it's a lossless format, so the picture will look identical to your TIFF, with the added benefit of usually resulting in a smaller file size. Take a look at Using macros in \DeclareGraphicsRule statement using shell command for an automated way of doing this on the fly.
    – Jake
    Jan 9, 2013 at 11:12
  • 6
    A printing house that requires a particular format would normally not want the image included into the latex at all they would want a blank in the main document and the images as separate high resolution bitmaps printed via a separate process for re-combination later. Jan 9, 2013 at 11:21
  • 4
    @user2168 Many print houses still ask for TIFF images, but that is separate from any typeset version as David says. In any case, LaTeX cannot read TIFF files, so you have no option but to convert them if you want to be able to typeset your document.
    – Joseph Wright
    Jan 9, 2013 at 11:23
  • 3
    tiff stands for "tagged image file format" -- it contains tags specifying format and actual images. so in principal, a tiff file can contain png, jpg, gif, and so on (since gif was still a proprietary format when pdftex was being developed, it supposedly couldn't be processed using free software, which led to pdftex dropping tiff format support). so you should in principal convert your tiff image into a format that matches that inside the tiff -- mapping gif to png as necessary. Jan 9, 2013 at 11:26

4 Answers 4

83

No TeX 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.

1
  • XeTeX on Mac OS X will read .tiff (and most other pixel image format) files, by using Mac OS X's coreimage for the heavy-lifting.
    – WillAdams
    Dec 23, 2015 at 20:32
6

This is an old question, but since it's very popular, I'm going to add my share of information to it.

As all other answers says, you have to convert the tiff to some supported format by LaTeX. All other answers suggest to convert to png, but I think that it is best to convert directly to pdf.

There are many reasons for this, because tiff is a container format that has many common features with pdf:

  • it supports different color spaces, and so if the original image is in ymck for example, you don't have to convert it to rgb (which is the case with png);
  • it has different king of compressions, most of which are supported by PDF, and so if the original image is black and white scan compressed with ccitt, you don't have to convert it to ten times bigger png;
  • it support vector clipping paths that can be preserved in the pdf.

For all these reasons, I think that is better to use something like tiff2pdf in place of convert to png.

0

Just for the record, since PNG might not be acceptable as it doesn't support CMYK, TIF might be needed for this reason (I was a while ago in this situation). JPG is not acceptable because it's a lossy format.

My solution was to convert the images in question from PNG (for screen) to TIF using convert (ImageMagick) and then again convert them using convert to PDF to make LuaLaTeX accept the image. I'm not entirely sure it's a good solution but it seems to work.

#! /bin/bash
# convert the PNG without an explicit profile to TIF with an explicit profile
convert RGB-input.png -colorspace CMYK -intent relative -black-point-compensation -profile path/to/CMYK-profile.icc CMYK-output.tif;
# convert the TIF image to PDF
convert CMYK-output.tif CMYK-output.pdf
0

By default, the most common LaTeX distributions such as TeX Live and MikTeX do not support .tiff images natively. However, you can still include .tiff images in your LaTeX document by converting them to a supported format such as .jpg or .png.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .