[Tex/LaTex] What causes latex.exe to be unable to import *.jpg, *.png, *.pdf directly

conversiongraphicsjpegpdfpng

Internally, what causes latex.exe to be unable to import *.jpg, *.png, *.pdf directly?

Best Answer

Knuth TeX (the original TeX engine) does not support any image directly. The only thing we can do is to use \special commands to tell dvi drivers to deal with image files. When .dvi files converted to PostScript through Dvips driver, PostScript images can be supported; and dvipdfm(x) support pdf/png/jpg format.

TeX needs to know the bounding box of imported images. Eps files is typically ASCII texts, and has a meta comment like

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 276 362 335 429

Then size of eps images can be rendered by TeX well. However, TeX cannot determine the size of binary image files (JPEG, PNG, etc.) itself, tools such as extractbb(mainly for dvipdfm) or bmpsize.sty(using pdfTeX) is needed.

If dvi is not the output format, modern TeX engines (pdfTeX, XeTeX and LuaTeX) can import binary images well.

Related Question