6

I ran into the following curiosity while using the graphicx package. When including two images of the same size, I scaled them using the same ratio (see example below). However the images didn't come out the same size. Does this have something to do with pixel density?

Here is a MWE:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
    \includegraphics[scale=0.25]{ModularComponents0.png}  
    \includegraphics[scale=0.25]{ModularComponents1.png}
\end{document}

Here are the two images:enter image description here enter image description here

and finally here is the screen shot of the MWE:

enter image description here

10

The one image is saved as 96 ppi, the other as 72 ppi. They have the same pixel dimensions (which is what your browser uses as seen above) but they aren't the same size, as in nominal area on paper, i.e. dimensions in mm/inch/whatever (which is what TeX uses). You can fix this with gimp or something like that. Or you use width or height instead of scale. scale has nothing to do with it by the way. If you omit it in your MWE, the size difference persists.

  • 2
    For anyone interested, gimp can change ppi by going to Image -> Scale Image -> X/Y resolution. – RghtHndSd Sep 19 '13 at 21:35
  • 1
    @RghtHndSd Right, I should have mentioned that. Also, for PNG this method is just fine because they are lossless and you can save them as often as you want without degradation. JPEG stores the ppi information in the EXIF data AFAIK and to change those, an EXIF editor would be a much wiser choice than gimp or any other image processor. Maybe ImageMagick is smart enough to not recompress the JPEG but that I do not know. – Christian Sep 19 '13 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.