Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use the following to embed an image:


whereas my_image is a JPG file, the image doesn't show in the correct format. It gets displayed bigger than the original my_image.jpg itself is and thus the quality is quite bad. Even when I do


for a picture my_image.jpg which is exactly 300px*100px in size, it gets displayed in greater size and stretched :( I have no header declaration which change \includegraphics settings. I would like images with plain \includegraphics{my_image} to be displayed in their REAL size.

share|improve this question
Your picture probably doesn't have the correct (or any) resolution information set, which is why it will appear scaled. See the answer to How to Include Picture in Original Size Into Document Page on Centre for one way of fixing this. –  Jake Jun 26 '11 at 12:37
It shouldn't be forgotten that px dimensions in pdftex have little to do with the resolution of included images. The default value of 1px is given by 72px = 1in. –  egreg Jun 26 '11 at 13:04
@Marc: IrfanView just displays the image at the natural resolution of the computer screen, so one image pixel is one screen pixel. LaTeX can't do that, because there is no equivalent concept of a natural resolution in a print document; instead it assumes the image to have a resolution of 72 pixels per inch if no other resolution information is provided in the metadata of the image (just providing width=300px,height=100px does not provide resolution information). –  Jake Jun 26 '11 at 13:44
@Marc: On a side note, you can notify people of comments you write; see meta.tex.stackexchange.com/questions/598/… –  Jake Jun 26 '11 at 14:04
@MarcEdlo let us continue this discussion in chat –  Jake Jun 26 '11 at 14:05

1 Answer 1

up vote 12 down vote accepted

When you take a screenshot or export a figure from Matlab as a rasterised image,usually the resulting image file will not contain any resolution information (or "pixel density", usually measured in "dots per inch", or "DPI") in its metadata. When you include such an image in a LaTeX document using \includegraphics, a resolution of 72 DPI will be assumed. For example, that means that a screenshot that has a size of 1440x900 px will have a width of 1440 px / 72 px per in = 20 in = 51 cm in your PDF or DVI, so it will most likely be too big for your document. A computer monitor with a horizontal width of 15 in (= 38 cm) that is operated at a screen size of 1440x900 px has a resolution of 1440 px / 15 in = 96 dpi. If you want your screenshot to have the same size (in this case a width of 38 cm) both on your computer screen and in the printed document, you need find a way of letting LaTeX know that the resolution of the image is 96 DPI. There are a number of ways you can do this:

As an option to includegraphics:
If you're compiling your document using pdflatex, you can specify the resolution of the image by loading it using \includegraphics [resolution=<resolution in DPI>] {<filename>}. This will only work if no resolution information is included in the image.

By setting the image metadata using GIMP:
Go to Image -> Scale Image... and adjust the X and Y resolution after making sure pixels/in is chosen in the drop down menu. Then save your image.

By setting the image metadata using IrfanView:
In IrfanView 4.30, you can click Image - Information (or press I) to show the metadata of the image. The fifth row is called Resolution and should contain two fields in which you can set the horizontal and vertical resolution in dots per inch. By pressing the button Change, the new resolution will be set. The "physical" size of the image in cm and inch, which is obtained by multiplying the size in pixels with the resolution, is shown in the eigth line, called Print Size (from DPI). You can then include the image in your LaTeX document by calling \includegraphics {<filename>} without any extra options.

By setting the image metadata using ImageMagick:
On Linux systems, frequently the ImageMagick programs are already present or can easily be installed. You can then set the resolution information by calling convert <original file name> -density <resolution> -units PixelsPerInch <new file name> in a shell. You can then include the image in your LaTeX document by calling \includegraphics {<filename>} without any extra options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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