I'm currently writing a LaTeX document which describes a technical installation and configuration process of a piece of software. I took two screenshots I want to include as figures in my document. These screenshots have been cropped to emphasise and keep focused on what's important in the context.
What I wanted to achieve was to reduce the size of both screenshots, because when they are inserted simply with \includegraphics{myFigure} without any option both figures are way too large to fit the paper size.
Up to now, in order to get the result I want, I tricked the width of these screenshots manually to make them appear the same real size. For example, for the first figure \includegraphics[width=0.75\textwidth]{myFigure1} and for the second \includegraphics[width=0.9\textwidth]{myFigure2}. I also tried the scale option to resize my images. But this isn't clearly the right solution as this requires checking manually to see if the compiled result looks more or less the same (approximation).
After some researches on the web and several discussions with guys from the IRC #latex channel on freenode, I got some more solutions.
First, I learned from this link that when I don't specify an option, images are assumed to use 72 as a default dpi. This is indeed correct as I recalculated manually the formula presented in that link.
I also learned that I could change the dpi of my figures with an image editor to make them fit the paper size. Contrary to what is written in the link above, there is no need to install a specific software to change the dpi of an image if you have GIMP installed. The latter has indeed such a feature. Go to Image -> Scale Image... and adjust the X and Y resolution after making sure pixels/in is chosen in the drop down menu. A screenshot on my XPS 13 (13") is shot at 97.003 dpi. I changed the dpi to 150 and both images are fitting the paper on the compiled LaTeX document (pdf). What's great is that this does not require to reduce the image I have (PNG) and lose quality. This problem does not occur with vector graphics obviously. While this solution sounds great, this still requires to open an image editor and change the dpi manually. This is rather annoying, even if batch scripting with ImageMagick can come in handy.
The aforementioned link also advices us to use the resolution option of the graphicx package, while there seems to be no option like that contrary to what is written in the documentation. To make sure, I even tried to compile my document with that option, and it failed to compile with it. Even the wikibook is advertising this option!
So my questions are:
- Why does this solution and the LaTeX WikiBook both advertize the
resolutionoption from thegraphicsxpackage while it clearly does not exist? Some specified that this option is only available on certain engines likepdflatex. I tried to verify that assumption, but it does not work. - Is there any pure LaTeX solution to specify the dpi of figures? I don't want a global command, as I want to be free to define the dpi for each bitmap image I include.
- Ideally, I would like the second figure to have a width equivalent to the size of
\textwidth. When a figure is resized, does LaTeX change its dpi to resize it? If true, I want in that case that the first figure takes the dpi of the second figure which has been resized with the value of\textwith. (I don't know if I'm clear for this part.)

scale=with the same factor. If you usewidth=then the images will use different scaling. – David Carlisle Nov 28 '14 at 10:07graphicx. The other question linked above and the LaTeX WikiBook both seems to make false assumptions: theresolutionoption does not exist, right? – wget Nov 29 '14 at 17:14widthmanually to eventually have the images have the same height? If so, why not adjustheightthen? – Werner Nov 29 '14 at 17:48resolutionoption does indeed exist, but apparently only if you're compiling usingpdflatex, not if usinglatex. – Jake Nov 30 '14 at 01:01\resizeboxso that the larger of the two is \textwidth wide. different back end drivers can add keys to\includegraphicsjust as they can change the list of supported filetypes.resolutionisn't a built in key defined by the package. – David Carlisle Nov 30 '14 at 11:47\resizebox:-/ Yes, I could use scale, but this is an approximation method: I need to check manually if the largest image is taking the width of\textwidthand need to change thescalevalue accordingly. – wget Dec 01 '14 at 17:06resolution, I checked @Jake assumptions, and compiling usingpdflatexwith theresolutionoption fails. Should I then correct the aforementioned answer to the question and the Wikibook page? So does this option really exist or not? – wget Dec 01 '14 at 17:07resolutionis there but you need to set it before\includegraphicspdftex.def says: % * Two experimental options added (HO): % *quiet: log messages are suppressed. % *resolution: sets \pdfimageresolution. % Because these options are not supported by graphicx, % they have to be set after \usepackage{graphicx}, eg. % \setkeys{Gin}{quiet,resolution=300} – David Carlisle Dec 01 '14 at 17:22scaleandwidthon the same level, both require the same amount of work. The problem is really for the first smaller image. How can I define its size based on the size of the larger image I included with\includegraphics[width=\textwidth]{myLargeScreenshot}Unfortunately I cannot use theresizeboxyou advised me to use, as both images are not in the same figure. – wget Dec 01 '14 at 17:28xetexoflualatexto compile I assume I cannot use\pdfimageresolution. Right? – wget Dec 01 '14 at 17:30pdftex.defso it should work there. – David Carlisle Dec 01 '14 at 17:49