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.
convert orig_image.jpg new_image.jpg. – Martin Scharrer Jun 26 '11 at 12:52convertwill preserve the resolution and unit information. If you want to change them, you will have to explicitly specify them usingconvert <original file> density <resolution> -units PixelsPerCentimeter <new file>. – Jake Jun 26 '11 at 12:59pxdimensions 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\includegraphics[width=300px,height=100px]{my_image}why doesn't it work than correctly? – tim Jun 26 '11 at 13:17width=300px,height=100pxdoes not provide resolution information). – Jake Jun 26 '11 at 13:44Image - Information(or pressI) to show the metadata of the image. The fifth row is calledResolutionand should contain two fields in which you can set the horizontal and vertical resolution in dots per inch. By pressing the buttonChange, 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)". – Jake Jun 26 '11 at 14:03