Anti-aliasing in Photoshop
Anti-aliasing is something that you are using all the time, even if you do not know what exactly it is. In this tutorial which is part of: how things works series, we will cover what is anti-aliasing and why you need it.
What is actually anti-aliasing?The base is that computer screen is actually a grid of squares (pixels) which can be filled with one color. One pixel can be filled with one color only, it cannot be divided into smaller unit. The pixel is smallest unit and cannot be divided, remember that.
In case you have a rectangle or square which is aligned to the pixel grid, everything will work just fine (edge or path exactly matches pixel grid, in other words).
The problem is that shapes can have curved lines (every letter you can type is the shape by the way). It is not possible to present smooth curved lines using square pixels and edges in that case will appear jagged. That's when anti-aliasing comes in place and use.
Simply putting, anti-aliasing is calculation. We will explore anti-aliasing using letter B typed in Photoshop. I will set anti-aliasing method from the drop-down list in the Options bar to None. As you can see on the screenshot below, every pixel of the shape B is filled with red color. I choose to use red color (R = 179, G = 0, B = 0), but it can be any color with the exact same result. Edges appear to be jagged, right? Letter B actually has smooth curved lines which can not be presented using square pixels.
I will apply Sharp anti-aliasing method from the Set the anti-aliasing method drop down list in the Options bar. Now we can see that some pixels along the edges has a bright red color. Note: screenshots are heavily enlarged, when looking at 100%, letter B will look nice and smooth along the edges, thanks to anti-aliasing applied.
I will convert letter B to work path, so we can see the actual shape of the letter B. What is actually happening here? I will try to explain using Opacity, which is a pretty accurate explanation. Basically, there is a calculation performed. It calculates how much of the shape path falls into any particular pixel in the pixel grid, sets that pixel color to color specified for the entire shape (letter B in this case) and reduces its opacity.
How to avoid anti-aliasing for shapes with straight edgesYou can avoid anti-aliasing for shapes with straight edges (it is not desired most of the time) by using Align Edges in the Options bar. Check this option when drawing rectangles and squares and you are safe, Photoshop will automatically snap edges of the shape to pixel grid and prevent anti-aliasing to occur.
There is also an option in Preferences > General section: Snap Vector Tools and Transforms to Pixel Grid. You can check it and this option will automatically snap edges of shapes and transformed objects to the pixel grid in order to avoid anti-aliasing which is usually not desired with objects which has straight edges.