# How can I print out the exact dimensions of my images?

Please note that while there is an existing question titled "How do I get the exact dimension of a picture in LaTeX?", that question is actually asking something different.

I have a document that contains several high-resolution png images, included as usual with commands like

\includegraphics[width=0.85\columnwidth]{landscape2.png}


within figure environments. However, my publisher is asking me for a version where each image is at "no more than 300 dpi, scaled at 100%".

This means, I think, that I have to manually resize all my images. I would like the document to look the same afterwards, so to do that I need to know exactly how much LaTeX is scaling them, or equivalently, the exact dimensions of the image as it appears in my document. That is, I need to know the numerical value of 0.85\columnwidth in inches, and if possible the height of the image in inches as well.

How can I find this out? I tried \showthe\columnwidth, but this gives the following extremely informative error message:

?


Is it possible to print the exact dimensions of an image, or the scaling ratio used, to the console?

• Store the image in a box: \setbox1=\hbox{\includegraphics[..]{...}}. Then \showthe\wd1 will print the width to the terminal, while \showthe\ht1 will print the height. If you want to display these in your document, use \the\wd1 and \the\ht1. The lengths will be in pts. For printing in other lengths, see the printlen package (or see How do I get the exact dimension of a picture in LaTeX?). – Werner Jun 21 '17 at 0:11
• @Werner why did you close my question as a duplicate of that one? Although the title of that question sounds like it's the same as mine, the question body is actually completely different, and the answers don't address my issue at all. (That person was actually trying to set the size of their image, not print it out, despite what the title says.) – Nathaniel Jun 21 '17 at 0:26
• The linked questions asks how to do both - obtaining the height/width of an image and how to set it. Jake's answer points to using printlen for getting the image lengths and printing them within your document using the desired dimension. I don't see the difference... anyone else? – Werner Jun 21 '17 at 0:35
• @Nathaniel Jake's answers seems to provide a solution to your problem (imho) -- see the second part. – ebosi Jun 21 '17 at 1:09
• @Nathaniel This information should by default be in the log file, for example <example-image.png, id=1, 401.5pt x 301.125pt> File: example-image.png Graphic file (type png) <use example-image.png> Package pdftex.def Info: example-image.png used on input line 5. (pdftex.def) Requested size: 401.49901pt x 301.12425pt. Gives you both the original size of the image and the size it will be in the output – samcarter_is_at_topanswers.xyz Jun 21 '17 at 12:12

Store the image in a box:

\sbox0{\includegraphics[..]{...}}


Then \showthe\wd0 will print the width to the terminal, while \showthe\ht0 will print the height. If you want to display these in your document, use \the\wd0 and \the\ht0. The lengths will be in pts. For printing in other lengths, see the printlen package (or see How do I get the exact dimension of a picture in LaTeX?).

You can find this information in the log file. The following short document

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\textwidth]{example-image-a}

\includegraphics[width=.5\textwidth]{example-image-b}
\end{document}


will tell you in the .log file both the original size of the image as well as the size within the document:

<example-image-a.pdf, id=1, pagebox=cropbox, 321.2pt x 240.9pt>
Package pdftex.def Info: Requested size: 345.0pt x 258.75659pt on input line 7.

<example-image-b.pdf, id=2, pagebox=cropbox, 321.2pt x 240.9pt>
Package pdftex.def Info: Requested size: 172.5pt x 129.3783pt on input line 9.