I have tried using both a png and jpg file format for my images but I still loose a significant amount of quality when I run pdflatex. Is there some way to work around this?

\documentclass[12pt, a4paper, twoside]{article}
I have some text here.  Then pics.
\includegraphics[scale=0.75, angle=90, width=\textwidth]{hamlet.jpg}
\caption{cool picture}
\includegraphics[scale=0.75, angle=270, width=\textwidth]{kinglear.jpg}
\caption{cool picture 2}
some more text here

Here is my png image king lear png

and here is the output of my pdflatex run (the rotation is intentional in the pdf) king lear pdf

  • 2
    Text in a png or jpg file always becomes distorted if you scale the image. – Ian Thompson Jul 28 '12 at 20:18
  • Ahh. So should I set the width instead of scaling the image? I did not realize that I was doing both. – Mike Stumpf Jul 28 '12 at 20:22
  • I got rid of the scaling but the output is still shoddy. Any thoughts? – Mike Stumpf Jul 28 '12 at 20:25
  • Whith your MWE and your JPEG picture, I see no difference between the original picture and the same picture included by LaTeX into a PDF... – Paul Gaborit Jul 28 '12 at 20:25
  • 2
    png and jpg images have an 'actual' size. They will suffer distortion if they are displayed at any other size, and the distortion is worst if the image contains text. An application such as photoshop may do a better job of resizing the image, but some distortion is inevitable. – Ian Thompson Jul 28 '12 at 20:27

LaTeX graphics packages

LaTeX and its graphics packages do not touch the image data. TeX does not even provide the reading of binary data. Thus LaTeX passes the image as file name reference to the driver. Also most of the drivers are not image processing programs. They only move the image data in a form appropriate for the output format. For example, dvips only copies the PostScript file into the output PostScript file. Also pdfTeX often do not need to unpack the image data and can copy the data to the PDF structures. Some PNG files are uncompressed and compressed. But this process does not change the image data.

Driver issues Very view drivers are able to resize an image, AFAIK Acrobat Distiller and GhostScript does some obscure things with images like using JPEG compression for PNG images. I do not know how this can be turned off. The related options given in Ps2pdf.htm seems to have no effect.

But you are using pdflatex that does not change the image data. This can be tested. Take a PNG image and convert it to PPM. Also embed the image in a LaTeX document and run pdflatex. The program pdfimages (xpdf) extract the image in PPM format.

convert image.png image.ppm
pdflatex test.tex
pdfimages test.pdf t
diff t-000.ppm image.ppm

The files t-000.ppm and image.ppm should be identical, if the PPM format is the same (there is a binary and an ASCII variant).

** Different viewing programs** However the programs to view the images are different. The image viewer and the PDF viewer are usually different programs that uses different methods for viewing. For example, a program might use anti-aliasing, …

Scaling vs. resizing

There are no problems in scaling images in LaTeX independent of its method:

  • Option scale
  • Options width, height
  • \scalebox

Only the place that the image uses on the page differs, the image data remains the same.

A different term is the resizing of an image. Then the actual number of pixels change. Of course, an image processing program cannot invent missing details if the image is enlarged. It can only use better or worse methods to limit the artefacts of resizing.


Screens have low resolutions comparing to printed media and are usually stupid bitmap images of the pixels on the screen even if the original data were high quality vector data (non-pixel fonts, vector drawings).

Some hints to get better quality:

  • In some cases a vector screenshot program might be available, e.g. gtk-vector-screenshot.
  • A special case are web pages. They could be converted to PDF by printing or there are programs/sites that perform the conversion. But caution, PDF, especially PDFs from screenshot programs might contain bitmap data instead.
  • Higher screen resolution with larger font/symbol settings or using settings for visually impaired people.
  • A large monitor helps that allows large windows for the screenshot programs that can only catch the pixels inside the screen.
  • And it can make sense to turn off anti-aliasing and similar (ClearType) to get clean pixel data. Thus that a black line is displayed by black pixels and not by many gray levels at its edges. That makes it easier to optimize the image for the final media.
  • Thank you. I created a high quality pdf with Nitro nitropdf.com and it seems to work better – Mike Stumpf Jul 29 '12 at 7:13
  • 2
    @Wrigley242 With detailed explanations of Heiko, I do not understand why you need software like Nitro. – Paul Gaborit Jul 29 '12 at 7:31
  • «pdflatex that does not change the image data. This can be tested… pdfimages… diff» I made an experiment [tex.stackexchange.com/questions/350379/… and found that xeatex/pdflatex change source PNG images. What is wrong? – Stas Fomin Jan 31 '17 at 12:12
  • @StasFomin Wrong test. Image data and the representation of the image data in a file are different. Additionally, a file can have comments, additional meta-data, ... Also, the image file formats can have some flexibility: order of chunks, ... A test based on the conversion to PNM is more close to the issue. – Heiko Oberdiek Jan 31 '17 at 17:32
  • @HeikoOberdiek, please look at [github.com/belonesox/xelatex-and-graphics-quality/blob/master/… — I compared images not by text diff but by compare from imagemagick, and get very nonempty diff-png github.com/belonesox/xelatex-and-graphics-quality/blob/master/… Metadata, order of chunks, etc… is not an explanation for this. – Stas Fomin Jan 31 '17 at 17:39

Whith your MWE and your JPEG picture, I see no difference between the original picture and the same picture included by LaTeX into a PDF...

Here is the result:

enter image description here

Verify that "Smooth images" is checked in "Page Display" category of Adobe Reader preferences.

  • Hello, yes it is. – Mike Stumpf Jul 29 '12 at 7:41

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.