6

I'm using preview for my iOS development to calculate pixel distance from elements. But now, I don't even remember since when it started antialiasing the lines, even 1 pixel line becomes a blurry mess and you can't find out where it actually begins.

How do I return crisp look to my images when zoomed in Preview?

  • 1
    I'm gonna be that guy and pedantically point out that this isn't antialiasing so much as bilinear texture interpolation (filtering). You're looking for the image to get rendered with nearest-neighbor sampling. – Steven Lu May 7 '16 at 13:39
8

I have a different experience from what CousinCocaine reports in their answer. Using Preview Version 7.0 (826.4) on a PNG bitmap, it seems to depend on the zoomed image size rather than on whether the zoom level is a nice number.

Specifically, it anti-aliases the zoomed image if the zoomed image would occupy more than 64 megabytes (2^26 bytes), using 3 bytes (24 bit color) per pixel. To add to the confusion, if the image has one small and one large dimension, the small dimension is increased to be 1/3 of the large dimension before doing this calculation.

For example, with a 720x720 image at a zoom level of 656%, the calculation is 720*720*6.56*6.56*3 < 2^26, so it doesn't anti-alias. But at a zoom level of 657%, it does.

image at 656% with no anti-aliasing

image at 657% with anti-aliasing

As you can see in the first screen shot, absolutely no anti-aliasing is performed. Each pixel has been zoomed to a 6x6, 7x7, or 6x7 rectangle, with no smoothing of pixels.

To see the pixels in those images clearly enough to count them, you don't need Preview -- just go to System Preferences, Accessibility, Zoom, and uncheck the box "Smooth images" (and also make sure at least one of the methods for zooming is enabled). Then you can zoom in on pixels anywhere on your screen (and you can use the pixels in the mouse pointer to help with visually counting pixels). But taking a screenshot while zoomed like this is buggy for me.


For PDFs, which probably doesn't apply to you, you could also try one of the following undocumented settings, which apparently also require restarting Preview:

defaults write com.apple.Preview PVPDFAntiAliasOption 0
defaults write com.apple.Preview PVPDFAntiAliasOption 1
3

In preview, you can look at your image on a 100% (1 image pixel = 1 screen pixel). To do this, make shure you have the right settings.

Go to Preferences, Images, Define 100% as: '1 image pixel equals 1 screen pixel'

preview prefs

Now when you open your image at 100%, you will see the original image. Here is an example of on iOS maps screenshot at 100%.

ios 100%

OK, but now the tricky part. Let's say that your image is 100 pixels wide, and we will zoom it 2x: The resulting image is 200 pixels wide. You computer will double each pixel and the image will be sharp. This will be true for every 'whole number' zoom (3x, 6x, 32x, etc).

So, zooming in whole numbers is easy. But what about zooming in non-whole numbers, like 133%? The 100 pixels in the example must be devided in 133 pixels, but which pixel is doubled and which is not, we can not splice screen pixels in halve, can we? In these circumstances the computer will calculate an estimated guess for the value of these 133 pixels and will result in your 'blur'.

You will find that some zoom levels are sharp (whole number zoom levels) and other zoom levels are blurry (uneven zoom levels). For this reason I have the extra '1' in my Toolbar, so I know when I am looking at '1 image pixel equals 1 screen pixel'.

Below an 'even' zoom level: even zoom level

Below an 'uneven' zoom level: uneven zoom level

  • 1
    This is a better answer than mine. I typed my answer hastily, so +1 for going in depth where I did not. OP should accept this answer. – aglasser Aug 28 '14 at 13:35
0

Preview on OS X Mavericks has antialiasing disabled for images, but enabled for PDF files. As far as I know, this setting cannot be modified in preferences.

This is Preview zoomed in on Dilbert's eyes:

Zoomed image in Preview

  • What is the screenshot? – CousinCocaine Aug 27 '14 at 21:13
  • An image zoomed in to show that antialiasing is disabled for PNG files. It does not smooth lines when zoomed. – aglasser Aug 27 '14 at 21:15
  • Updated the picture with a better example – aglasser Aug 27 '14 at 22:45
  • This might look like anti-alias... I think zooming and taking a screenshot is not the best way to show this. We have no clue what the original looks like and the anti-alias will happen after the zoom. In other words, you can not zoom in on your anti-alias like this. Might be you can compare PNG and PDF (side by side) and at 100% and 400%. (+1 for Dilbert though ;) – CousinCocaine Aug 28 '14 at 6:44
  • @CousinCocaine: We can see from the window's title bar that the screen is not zoomed -- just the image is zoomed, within Preview. And we can see from all those nice sharp corners on the square pixels that it is not anti-aliased. – Matt Feb 23 '15 at 21:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .