3

Possible Duplicates:
Included PNG appears blurry in PDF
My pixel perfect picture gets blurry when compiled in LaTeX

I often need to use pixel graphics in LaTeX files (mostly screenshots), but I don’t really know what’s the best way to do it. Let me illustrate the problem I am having with the following minimum working example:

\documentclass{scrartcl}
\usepackage{graphicx}
\begin{document}
\includegraphics{scrot.png}
\end{document}

You can get scrot.png from http://t.zekjur.net/tex/scrot.png (it’s just a screenshot I made with the tool scrot. Any pixel graphic will do).

After using pdflatex mwe.tex I get mwe.pdf. The picture in it looks good (sharp, not scaled but at its native size) in Xpdf when I chose 100% zoom level. However, when I open the same file with evince instead of Xpdf, I cannot get the picture to look good -- no matter which zoom level I choose.

This is what it looks like in Xpdf:

and this is what it looks like in evince:

What is the reason for this problem and what is a better way (aside from using vector graphics, obviously)?

Michael
  • 131
  • 2
    This is probably Evince trying to be "clever", interpolating you image with the rather bad nearest-neighbour algorithm. There's not much you can do about it, AFAIK. At least that's what this evince bug report suggests. – You May 16 '11 at 21:34
  • @You: Since when is nearest-neighbor considered in any sense "clever"? (Is it not the most naive rescaling algorithm known to man?) – SamB May 17 '11 at 18:22
  • @SamB: Sometimes clever can mean not only good, but also fast. :-) – Andrey Vihrov May 17 '11 at 18:48
  • @You: OK, let’s assume Evince scales badly. Why is 100% in Evince a different size than 100% in Xpdf? – Michael May 17 '11 at 21:14
  • @Michael: Ask the developers. All I can say is that rendering is going to differ between viewers. – You May 17 '11 at 21:36
  • I closed this a duplicate to the above mentioned questions. If you think otherwise feel free to request the question being reopened. – Martin Scharrer May 17 '11 at 21:46
  • 1
    @Michael: 100% differs because different applications have a different idea of what 100% means. Some applications assume that the screen resolution is, e.g., 96dpi, and then you might be lucky and get nice results if you include a 96dpi image and use 100% zoom. Some other applications use the physical resolution of your monitor (which might make sense with a monitor but is meaningless with a projector). – Jukka Suomela May 17 '11 at 22:37

0 Answers0