How to Get Pixel-Perfect Hard Edges in Photoshop
May 18, 2011One of my biggest pet peeves is the lack of pixel-perfect, hard edges in Photoshop. You know… Those soft, anti-aliased edges that mysteriously appear on one or two sides of an object? I usually get these when dealing with vector objects in Photoshop, whether they have been imported from Illustrator or created with one of Photoshop’s own object tools.
After having tried many techniques, it appears that CS5 may have finally addressed this. Thanks to Smashing Magazine, no longer will a designer or developer have to resort to voodoo magic tricks (a.k.a. – rasterizing and erasing) these soft edges.
Here is how you preserve hard edges each and every time when dealing with vector objects created in Photoshop:
- Make sure your vector element is of an EVEN width and EVEN height (i.e. – 30 x 40 instead of 31 x 40)
- Alternatively, make sure your vector element is of an ODD width and ODD height (i.e. – 31 x 41 instead of 30 x 41)
Now, how about those pesky elements pasted from Illustrator? Simply follow the guidelines above, but – before pasting –draw a marquee of:
- even width and even height (if the element you are pasting is of even dimensions)
- odd width and odd height (if the element you are pasting is of odd dimensions)
Note that you don’t have to make your marquee match the width and height of the pasted object… It can be 1 x 1 if you’d like. Just make sure it is of the same even or odd ratio as the artwork.
Thats it! After all that frustration, it all comes down to a numbers game. But beware… Soft-edges can affect raster elements as well. If – for example – you rotate an image using “Edit > Transform” or “Edit > Free Transform”, say hello to those soft edges again. The answer to this? Oddly enough, rotating via “Image > Image Rotation” does not create the “soft-edge problem”, so use this method instead.
Enjoy!