[Tex/LaTex] pdfTeX and JPEG2000

graphicsjpegpdftex

In Which graphics formats can be included in documents processed by latex or pdflatex?, the answers indicate that that pdfLaTeX understands JPEG2000. For me it doesn't work and the above link seems to be about the only place where a .jp2-positive statement is made.

Could someone please clarify the matter for me?

Best Answer

pdfTeX cannot handle JPEG2000 images, but LuaTeX can.

For LuaTeX pdftex.def can be extended to support .jp2 as file extension for JPEG2000 files:

Workaround:

\usepackage{graphicx}
\usepackage{ifluatex}
\ifluatex
  \usepackage{ifpdf}
  \ifpdf
    \expandafter\ifx\csname Gin@rule@.jp2\endcsname\relax
      \DeclareGraphicsRule{.jp2}{jpg}{.jp2}{#1}
      \DeclareGraphicsRule{.JP2}{jpg}{.JP2}{#1}
      \usepackage{grfext}
      \AppendGraphicsExtensions{.jp2,.JP2}
    \fi
  \fi  
\fi

This adds a rule for .jp2 (and the uppercase variant .JP2) and adds the extension to the search list of the supported graphics extensions.

A small test file worked for AR9.5.5/Linux, but other PDF viewers (xpdf 3.03, ghostscript 9.05, evince 3.4.0) are not able to display the image properly.