4

In my document I have a lot of images. Some are small icons and others are massive screenshots. The images should display either

  1. Their full resolution if the image is smaller than the width of the document, or
  2. Scaled down to the width of the document itself if the image is larger.

Right now each image is scaled to the width of the document regardless of how big the original image is. This means that the smaller images are blown up and pixelated, but the larger images look great.

Thanks!

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Symbol 1 May 28 '15 at 15:58
  • Roughly speaking you can always have some \if-statements. However things become complicated if, say, your images are of different sizes and resolutions and you have a specific output device. For example, what do you expect if there is a 600dpi, 22cm-wide figure and your printer is of 600dpi? Probably you can fit that 22cm into \textwidth (about 14cm by default) but it would not be a good ratio. Setting scale=.5, at least in this case, might be better. – Symbol 1 May 28 '15 at 16:13
4

The easiest way is to use the adjustbox package with its export option so it passes its keys to \includegraphics then use max width=\textwidth

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.