# Losing resolution when using \includegraphics to import JPEG.

I'm using \includegraphics{} with the graphicxpackage to include some pictures. There is quality detoriation though (see example images). How can I fix this?

I want a 1 to 1 insertion of a 756x510px image.

The first pciture is a zoom in from the original (razor sharp pixels), while the second one shows a close up on the pdflatex-created pdf document. As you can see there is blurryness.

-
Using pdfLaTeX the JPEG should be included into the PDF unchanged. This blurriness might be caused by the PDF reader. See Included PNG appears blurry in PDF. –  Martin Scharrer May 10 '11 at 17:15
Did you check whether the display smoothing of your pdf viewer is switched off? That's what the issue was in the question tex.stackexchange.com/questions/10975/… –  Jake May 10 '11 at 17:15
Yes, the issue is because of some smoothing done by Preview.app. I use this app also to open up the JPEGs but it seems this option affects only text etc. I'm guessing Preview.app interprets everything in a PDF document as text. –  romeovs May 10 '11 at 18:01

• Use pdfLaTeX for directly including jpeg images, avoid conversion such as by dvipdfm or dvips and ps2pdf.

• Set the pdfTeX compression to none:

\pdfcompresslevel0

Possible compression values are 0 to 9, 0 should commonly be the default (set in pdftex.cfg) and means "no compression", 9 is for strongest compression.

Also, to avoid problems with lossy jpeg compression, you could convert them to lossless png format and include the png versions.

-
Does the \pgfcompresslevel affect included JPGs? So far I know they are copied unchanged into the PDF as binary objects. In my tests I was able to extract them from the PDF with identical MD5 checksums. However, its not impossible that pdftex might recode them in certain situations. –  Martin Scharrer May 10 '11 at 17:18
Sorry for being pedantic, but I keep seeing this on this site: JPEG (Joint Pictures Expert Group) or JPG for short, PNG (Portable Network Graphics) and PDF (Portable Document Format) are acronyms and therefore should/must be written in uppercase, especially if someone talks about the format. If it is about the file extension I would write it like .jpg, .png, .pdf. –  Martin Scharrer May 10 '11 at 17:24
@Martin: No problem about being pedantic. I just decided to keep capitalization consistent with regard to the lowercase names of mentioned tools such as dvips and ps2pdf and pdfLaTeX with acronyms in names. Feel free to edit. :-) –  Stefan Kottwitz May 10 '11 at 17:29
your first point is good advice: ps2pdf with default options will lossily reencode JPEG and look worse (unfortunately the Adobe Distiller PassThroughJPEGImages setting is not implemented by ghostscript). However, your second point is irrelevant: \pdfcompresslevel does not affect the way pdftex includes jpegs. Your advice to convert to PNG is also not helpful: the loss of information happened in the original conversion to JPEG. Converting to PNG will not bring it back. –  Lev Bishop May 10 '11 at 19:21
@Lev: Of course conversion to PNG cannot bring information back. Though it preserves the current quality as embedding and possible reencoding should not bring further loss. I meant it as a general advice when working with already existing JPG, to prevent further loss during work, also possibly relevant here. Or would you recommend to keep JPG if quality matters? –  Stefan Kottwitz May 10 '11 at 19:33