MacOS – How to disable antialiasing (smoothing) in Preview for images

macos

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?

Best Answer

  • 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