Under TexWorks XeLaTeX, I try to \includegraphics a .NEF file. I get the error message in the title, except that this includes "(NEF)" for better targetting. Of course, I can convert .NEF to .pdf, .png or other loadable formats. But I have several hundred of these .NEF's, and for final high-quality publication (coffee-table book) I will need that format. Similar questions have been posed about .tiff images; answers "impossible". Is that still true?

  • Welcome to TeX.SE!. Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Cragfelt Dec 18 '17 at 0:25
  • NEF as in Nikon RAW? Doesn't work. Even including 16-bit TIFFs is hard, NEF has additional magic in it. My recommendation: batch-convert to PNG, it will be lossless, even if you loose linear color depth. It can be done with a for loop in your shell and dcraw. Then include PNG files. – Oleg Lobachev Dec 18 '17 at 0:28
  • 1
    Please add to your question what a .nef file is. I do not know this extention ... – Mensch Dec 18 '17 at 0:49

There is no way to directly include TIFF files with pdflatex. The program pdftex used to support some TIFF files, but the developers eventually decided against this, because reall supporting TIFF means supporting tens (perhaps hundreds) different formats. So conversion to PNG seems the only alternative.

I tested the following after downloading a sample NEF file from http://www.luminescentphoto.com/nx2/nefs.html and making sure the dcraw (for GraphicsMagick) or ufraw (for ImageMagick) utilities are available on the machine.

The example file is


  % convert #1 \OutputFile  % for ImageMagick (uses ufraw)
  gm convert #1 \OutputFile % for GraphicsMagick (uses dcraw)




to be run with pdflatex -shell-escape.

This will do the conversion on the fly, but just once, producing the file baby-nef-converted-to.png.

Use one of the two lines above depending on what conversion program you have or prefer.

Some figures: the original NEF file is 18 MiB; conversion with dcraw produces a 13 MiB PNG file (8-bit/color); conversion with ufraw produces a 55 MiB PNG file (16-bit/color). Take your pick or adjust the conversion options.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.