# Dimension too large for one image

I want to include one image (G0004.jpg) and I got the following error:

D:\Documents\HEIA\Physique\Analyse_spectrale\temp.tex:16: Dimension too large. [...cs[width=0.95\textwidth]{images/G0004.jpg}]
D:\Documents\HEIA\Physique\Analyse_spectrale\temp.tex:16: Dimension too large. [...cs[width=0.95\textwidth]{images/G0004.jpg}]

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{geometry} \geometry{ a4paper, margin=2.5cm }
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[squaren,Gray]{SIunits}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{tabularx}
\usepackage {array}
\graphicspath{ {images/} }
\begin{document}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.95\textwidth]{images/G0004.jpg}
\caption{caption}
\label{fig:label}
\end{figure}
\end{document}


• Your image is probably too large, you should reduce with some external tool. See also tex.stackexchange.com/questions/257153/… May 5, 2017 at 8:33
• I can't reproduce the problem with your uploaded image. May 5, 2017 at 8:36
• My image is 700x600 px. I if y try with another one, i dont have the error. May 5, 2017 at 8:38
• @Warok This is exactly the one i used(700x600 px see). It works. Try to move the image in the same folder. May 5, 2017 at 8:42
• Uploaded images inserted here in the questions are not the originals graphics. You would have to put it to some upload service if someone should inspect it. Perhaps it has some faulty resolution. May 5, 2017 at 8:47

\includegraphics[width=0.95\textwidth]{images/G0004.jpg}


you should try

\includegraphics[width=\textwidth, height=0.9\textheight,
keepaspectratio]{images/G0004.jpg}


Since the figure environment contains a caption but (apparently) no legend, it should suffice to set aside about 0.1\textheight to place the caption material.

Incidentally, since the float is almost certainly going to occupy an entire page, you might as well replace \begin{figure}[htbp] with \begin{figure}[p]. If nothing else, there'll be less code clutter.

• That's a good suggestion, but the example image is in landscape format (W:H = 700:600) and the paper is A4 (portrait) so this should not be the problem here. May 5, 2017 at 9:54
• @Schweinebacke - Thanks. Let's see if the OP provides more information about the natural dimensions of the file G0004.jpg.
– Mico
May 5, 2017 at 10:31
• @Mico your method will not works for one figure: \includegraphics[width=0.0009\textwidth, height=0.0009\textheight, keepaspectratio]{./figure/figure8/ab01} Oct 30, 2019 at 15:39
• @acsdaswe - A message such as "your method will not work" is not all that specific and hence is not actionable. What exactly isn't "working"? Is LaTeX throwing an error message? If so, what does the message say? At any rate, I'm afraid I fail to understand your intended use case: What are you trying to achieve by displaying an image whose height and width dimensions are so minuscule as to make the image virtually invisible except under exceptionally high magnification? Please elaborate.
– Mico
Oct 30, 2019 at 16:21