Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here's my problem.

I have this picture: http://dl.dropbox.com/u/3394117/Temp/fig1.png (I have the original in Pixen and could export it to several different formats. I went with png though since it's lossless.)

Anyhow. When I open my picture in Preview (OS X) and zoom in, it looks fine. The characters have extremely sharp boarders between them and the background. However, when I put it into my latex document, compile it to a pdf (using TexShop) and then zoom in, it suddenly have gotten blurry (see screenshot: http://dl.dropbox.com/u/3394117/Temp/Screen%20shot%202011-02-13%20at%2012.46.30.png).

Minimal working example:

\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[scale=1]{fig1.png}
\end{document}

In the end, I would like to be able to scale the picture freely without there being any blurring at all.

Does anybody have any solution to my problem?

share|improve this question

migrated from stackoverflow.com Feb 13 '11 at 13:12

This question came from our site for professional and enthusiast programmers.

1  
    
Dan: The screenshot works now. Thank you for pointing that out. –  Speldosa Feb 13 '11 at 15:43
    
Stefan: Thank you for those links. I will check them out. –  Speldosa Feb 13 '11 at 15:44
add comment

3 Answers

This is just an effect of the display settings of your PDF viewer. In Acrobat Reader 9, for example, there is an option "Edit | Preferences | Page Display | Smooth images". If you uncheck this box, the picture will not be anti-aliased. When printing, your image should look fine regardless of the smoothing effect you see on screen.

Here's your file in Acrobat Reader 9, zoomed to 800%, left half with the default "Smooth images", right half with the option unchecked. Note the tick mark and the red X:

enter image description here

share|improve this answer
    
OMG! :) Well that exaplains a lot. Still I'm using PDF to actually be able to control how everybody else sees my content. Nice to know that the print wouldn't be affected anyway. –  Speldosa Feb 13 '11 at 15:41
    
I was now asking on comp.text.tex about a pdftex or PDF setting which can be used in the document to tell the PDF viewer not to use anti-aliasing. –  Martin Scharrer May 17 '11 at 21:59
add comment

Here is a comparison on my system of the PDF output side by side with your original PNG. The PDF is on the left and the PNG on the right. I can see some slight differences, but I would not describe the PDF as blurrier.

enter image description here

PNG may be lossless, but it's still a bitmap format, and hence will look bad when zoomed in on, especially for a very small image like yours. Does Pixen have the option for exporting to a vector format, like EPS or PDF (or SVG, which you could then convert using other tools)? That would be better than PNG.

share|improve this answer
3  
+1 for vector formats. If you're feeling hardcore, redraw the whole thing in TikZ... –  Seamus Feb 13 '11 at 13:45
    
Yes, it can export to for example ESP. However, when I do that, I get the same result. I have to admit that I don't really understand how different images are handled. For example, if I import the picture to Pages (iWork) and make it bigger, before I release the mouse it looks exactly like I want it (no blurryness at all, sharp boarders et cetera) but when I release the button, it gets blurry as if Pages wanted to "help" me somehow. Guess the same thing is happening in LaTex...or? Anyway. I solved it in an ugly way (see solution suggestion from myself). –  Speldosa Feb 13 '11 at 13:55
    
@Speldosa: That behaviour in Pages is the "display smoothing" again: Pages assumes that you don't want to see the hard edges of your pixels and tries to make it look pretty by smoothing over it, which would be fine for photos, but not for pixel art. The underlying picture is fine, it really is just a display option of the picture viewer (or the PDF viewer if the image is included in a LaTeX document). –  Jake Feb 13 '11 at 13:59
    
@Jake: Oh, I see. Then I guess it is preferable to do something along the lines with what I did (make the picture bigger) to get it to be shown properly for most people. –  Speldosa Feb 13 '11 at 14:01
    
@Speldosa, I'd guess that Pixen is just putting a bitmap graphic in an EPS wrapper. Try importing into an actual vector graphics editor that has vectorize/trace capabilities like Inkscape -- I do think it's the viewer making the difference, but I still think vectorizing it would help. –  frabjous Feb 13 '11 at 14:03
show 3 more comments
up vote 3 down vote accepted

Ok. I got it to work now. It was ugly but it works.

What I did was the following. I zoomed in on the picture in Pixen so that it covered my entire screen. I then took a screenshot, imported it into Pixelmator and exported it as a png-file.

Now it looks great! It's not until you zoom in really, really far that you notice the blurring.

It would be neat to be able to zoom without getting any blurring at all. Maybe I should do vector pixel art next time (I'll see if InkScape can fulfill my needs).

share|improve this answer
2  
Isn’t Jake’s answer more apt? I.e. disable the smoothing setting in your PDF viewer? –  Konrad Rudolph Feb 13 '11 at 14:23
2  
@Konrad: Well, if you send the pdf file to someone else, they might be rather annoyed if they're told to change viewer settings for best onscreen viewing. –  Hendrik Vogt Feb 13 '11 at 14:34
    
@Hendrik True, but this is a limitation (and, in my opinion, plainly a bug) in the viewing software and this workaround may not work as expected in some other viewers. In fact, the fact that this workaround works at all is probably also a bug that may get fixed some time in the future. –  Konrad Rudolph Feb 13 '11 at 14:50
    
That will definitely help if you have to keep using a raster format -- you can always scale them down to fit the available size without losing visible quality. –  Mike Renfro Feb 13 '11 at 15:26
1  
I still don't see why my solution wouldn't always work. What I've done is to effectively heightened the resolution of my picture so that it, when it is presented as a smaller image, will be able to show the picture without blurring. If I however send my PDF to someone else and this person don't know how to goof around with the PDF reader, then I'm pretty much screwed. –  Speldosa Aug 3 '11 at 15:13
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.