I am creating pdfs by including some random images from a large scale image database. The resolutions of images in this database are very different, so I can't change the resolution. Besides that, because of the layout restriction I can't use some existing solutions of similar question.
Note: you can download images here.
\documentclass{article}[10pt]
\usepackage[margin=0.5in]{geometry}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\usepackage{xcolor}
\newcommand\pic[1]{
\includegraphics[width=1cm]{#1}
\hspace{0.25cm}
}
\newcommand\rdpic[3]%
{\begin{tabular}[]{@{}l@{}}
\footnotesize\color{blue} #1\\[-1ex]
\footnotesize\color{blue} #2\\
\pic{#3}
\end{tabular}%
}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}%
{>{\begin{sideways}\color{red}}m{2ex}<{\end{sideways}}%
X%
}
\toprule
row 1
& \pic{1-13.jpg}
\\\midrule
row 2
& \rdpic{1}{-0.4602}{1-13.jpg}
\rdpic{2}{-0.4600}{140a900f-0781-4627-80eb-d8789de17812.jpg}
\rdpic{3}{-0.4600}{5d7bb2d2-041a-420c-a470-384aa15dbe83.jpg}
\rdpic{4}{-0.4599}{be21f5f1-ad2c-4389-8473-7b18c68e4eb9.jpg}
\rdpic{5}{-0.4599}{ae5d6366-7d30-4755-bcf1-34fae2be0054.jpg}
\rdpic{6}{-0.4598}{ed3ae766-9a7e-4f3b-8b57-c6c97b68a04a.jpg}
\rdpic{7}{-0.4598}{c2e177d3-38a6-48bb-91ca-ee88810fb2c7.jpg}
\rdpic{8}{-0.4598}{377a7efa-af04-4c21-8284-d0647949aa69.jpg}
\rdpic{9}{-0.4598}{9b521e94-55d8-4c68-8f22-fb7dd0ce8953.jpg}
\rdpic{10}{-0.4598}{96ce00e6-f672-4d49-8a90-dd5855eb093f.jpg}
\\\midrule
row 3
& \rdpic{1}{-0.4602}{1-13.jpg}
\rdpic{365113}{-0.1779}{10-13.jpg}
\rdpic{421389}{-0.1196}{2-13.jpg}
\rdpic{618943}{0.0728}{3-13.jpg}
\rdpic{801031}{0.1514}{4-13.jpg}
\rdpic{569609}{0.0503}{5-13.jpg}
\rdpic{655861}{0.0862}{6-13.jpg}
\rdpic{894375}{0.7555}{7-13.jpg}
\rdpic{136541}{-0.3524}{8-13.jpg}
\\\bottomrule
\end{tabularx}
\end{document}
Best Answer
really, the example is not at all minimal, it can easily be cut down to the following just by deleting things and checking the error still occurs
If you look at the log or terminal output you see
So before the graphics package arithmetic gave up with the
! Dimension too large
pdftex had given up reading the natural size of the image and had underflowed its width to be showing as negative maxdimen. Given that starting width any attempt to scale the image to any size is going to fail in arbitrary ways.There seems to be something odd in that file, if I just get imagemagic convert to re-write the jpg
Then pdftex reads it with no problem and shows:
That is, it read the initial width as 718.685pt