Tue Jul 14 20:11:00 2015, original submission:
This is an crosspost from http://tex.stackexchange.com/q/255220/2891. The problem shows when we try to include some image in format which is not supported in dvi mode:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{someimage.png}
\end{document}
It turns out that graphicx package tries to find the bounding box of the image. It tries that by reading the image data. But because images are binary, this cause LuaLaTeX to complain about incorrect utf8 value. It easily exceeds 100 errors and the document fails to compile.
David Carlisle proposed a solution using \DeclareGraphicsRule:
\DeclareGraphicsRule{.png}{bmp}{.xbb}{}
\DeclareGraphicsRule{.jpg}{bmp}{.xbb}{}
\DeclareGraphicsRule{.gif}{bmp}{.xbb}{}
with this code, images aren't parsed for the bounding box, but .xbb files are used instead. They can be created using
ebb -x imagename
This solution fixes also behavior with normal LaTeX, as bounding boxes weren't loaded with it as well.
More details are provided in my answer to the question on TeX.sx
Patch for literate sources is attached.
|