[Tex/LaTex] Included PNG appears blurry in PDF

graphicspdftex

This is a follow-up to Included png appears too big in PDF, but it's a separate issue so I'll put it in its own question instead of burying it in comments.

The problem: an included PNG, included without scaling, appears blurry in the PDF, as if the PDF has run it through a lossy compression.

I have tried multiple times with different values for either \pdfimageresolution or \includegraphics[width=...,height=...] added to the source below but no luck.

Is there any way I can check log compresses the image as it appears to do?

And to be thorough, I'm looking at the PDF in Foxit 3.2 at 1:1 zoom.

\documentclass[12pt]{article}
\usepackage[letterpaper]{geometry}
\geometry{top=1.0in, bottom=1.0in, left=1.5in, right=1.0in}
\usepackage{graphicx}
\begin{figure}
  \includegraphics{chart}\\                            % line 35 
  \caption{Adjusted Relative Risk (RR)}\label{mylabel} % line 36
\end{figure}

Log is:

Command Line:   texify.exe --pdf --tex-option=--synctex=-1 "C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\test1.tex"
Startup Folder: C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW

This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8)
entering extended mode

("C:/Documents and Settings/myself/Application Data/WinEdt Team/WinEdt 6/RW/t
est1.tex"
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman, ngerman, german-x-2009-06-19, ngerman-x-2009-06-19, french, loaded.
(C:\MiKTeX\tex\latex\base\article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(C:\MiKTeX\tex\latex\base\size12.clo)) (C:\MiKTeX\tex\generic\babel\babel.sty
*************************************
* Local config file bblopts.cfg used
*
(C:\MiKTeX\tex\latex\00miktex\bblopts.cfg)
(C:\MiKTeX\tex\generic\babel\english.ldf (C:\MiKTeX\tex\generic\babel\babel.def
))) (C:\MiKTeX\tex\latex\graphics\graphicx.sty
(C:\MiKTeX\tex\latex\graphics\keyval.sty)
(C:\MiKTeX\tex\latex\graphics\graphics.sty
(C:\MiKTeX\tex\latex\graphics\trig.sty)
(C:\MiKTeX\tex\latex\00miktex\graphics.cfg)
(C:\MiKTeX\tex\latex\pdftex-def\pdftex.def)))
(C:\MiKTeX\tex\latex\geometry\geometry.sty
(C:\MiKTeX\tex\generic\oberdiek\ifpdf.sty)
(C:\MiKTeX\tex\generic\oberdiek\ifvtex.sty)
(C:\MiKTeX\tex\latex\geometry\geometry.cfg))
(C:\MiKTeX\tex\latex\base\flafter.sty)
(C:\MiKTeX\tex\latex\setspace\setspace.sty
Package: `setspace' 6.7 <2000/12/01>
)
("C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\t
est1.aux") (C:\MiKTeX\tex\context\base\supp-pdf.tex
[Loading MPS to PDF converter (version 2006.09.02).]
)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
[1{C:/MiKTeX/pdftex/config/pdftex.map}] [2]
<chart.png, id=15, 362.11884pt x 257.55798pt> <use chart.png>
Underfull \hbox (badness 10000) in paragraph at lines 37--38

[3] [4 <C:/Documents and Settings/myself/Application Data/WinEdt Team/WinEdt 
6/RW/chart.png (PNG copy)>]
("C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\t
est1.aux") )
(see the transcript file for additional information)<C:/MiKTeX/fonts/type1/publ
ic/amsfonts/cm/cmbx12.pfb><C:/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb><
C:/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb><C:/MiKTeX/fonts/type1/publi
c/amsfonts/cm/cmr17.pfb><C:/MiKTeX/fonts/type1/public/amsfonts/cm/cmr7.pfb><C:/
MiKTeX/fonts/type1/public/amsfonts/cm/cmr8.pfb><C:/MiKTeX/fonts/type1/public/am
sfonts/cm/cmti10.pfb>
Output written on test1.pdf (4 pages, 100135 bytes).
SyncTeX written on test1.synctex
Transcript written on test1.log.

Clarification: The blurriness is visible on-screen when looking at the PDF at 1:1 zoom. I haven't printed it.

Best Answer

A 94dpi PNG figure included in a PDF file will certainly look blurry on screen.

Most likely your PDF viewer doesn't show your document so that 1 pixel in the PNG file corresponds to 1 pixel on screen. Even if you manage to find exactly the right zoom level, the origin of the PNG file is not necessarily aligned with screen pixels. Some kind of interpolation is done in virtually any situation if you have PNG (or JPEG) figures in PDF files.

How to do it correctly:

  • Use vector graphics for line drawings.

  • Use high-resolution JPEG files for photos. Something like 300 dpi is usually enough; looks good on screen and when printed. There is always some scaling and interpolation involved when displayed on screen, but in practice you don't really see any softness in photos.

  • If you have a line drawing and if you really must use raster files instead of vector graphics, then use very high-resolution PNG files. Something like 600 dpi is usually enough. It looks good when printed. It will look reasonably good on screen; there will be some softness, e.g. horizontal and vertical lines are not as sharp as you would like, but you can usually live with this solution fairly well.