5

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!

2
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Symbol 1
    Commented May 28, 2015 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
    Commented May 28, 2015 at 16:13

1 Answer 1

5

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

5
  • max width=\textwidth does not seems a right latex command. Did you mean \includegraphics[maxwidth=\textwidth]{figure.png}?
    – user
    Commented Nov 17, 2019 at 22:20
  • @user see adjustbox manual Commented Nov 17, 2019 at 22:29
  • I used this answer: Includegraphics maximum width
    – user
    Commented Nov 17, 2019 at 22:39
  • @user yes as Martin says there, as he says in the adjustbox manual, the key is max width, I am not sure what you are asking in these comments? Commented Nov 17, 2019 at 22:52
  • I am not sure what you are asking in these comments? On the first comment, I asked a question, you answered. End. On the second comment, I did not asked any questions, I just referenced/linked a answer I found related to this question.
    – user
    Commented Nov 17, 2019 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .