Thứ Ba, 22 tháng 3, 2011

Pixel perfect vector pasting

Pixel perfect vector pasting

If you’ve drawn pixel snapped artwork in Illustrator and pasted it into Photoshop as a shape layer, you may have noticed that the results can vary from exactly what you’d expect—a perfectly sharp image—to a blurry mess. Here’s how to fix that.
Below is some artwork as it appears in Illustrator. Perfectly formed, snapped to the pixel grid, and at the size we intend to use it in Photoshop.

The same paths, pasted into Photoshop a few times. Notice how only the top left version is sharp, while the others are half a pixel out on the X axis, Y axis, or both.

What went wrong?

Photoshop’s pasting behaviour works one of two ways. If there’s a selection, the clipboard contents is pasted so the center of the clipboard is aligned with the center of the selection. If there isn’t a selection, it’s pasted so the center of the clipboard aligns with the center of your current view. How far in you’re zoomed and the portion of the document you’re viewing will determine the result.

A fix

Our test artwork is 32 pixels wide and 12 pixels high. Drawing a 32×12 pixel marquee selection in Photoshop will force the artwork to land exactly where we want it, and to be pixel aligned. This works every single time.

An easier fix

The marquee doesn’t have to be the exact size of your artwork though. In our case, a 2×2px selection would work just as well. This is because the center of an even width and height marquee selection and the center of an even width and height clipboard contents falls exactly on a pixel boundary, which is what we want. If the artwork was an odd width and height, a 1×1px selection would have been required.

If you can’t be bothered taking note of your artwork’s dimensions, then drawing the appropriately sized marquee, you can draw a 2×2 pixel selection and paste. If the image is blurry on the X axis only, make the selection 1×2px and paste again. If the image is blurry on the Y axis only, make the selection 2×1px and paste again. If the image is blurry on both axis, make the selection 1×1px and paste again.
It may sound complex, but in practice it’s very quick—you’ll only ever have to paste twice to get sharp vector paths from Illustrator.

Smart objects

Pasting as a smart object doesn’t have the same issue (in Photoshop CS5, anyway). I like to use shape layers though—they give more control and edibility.

Không có nhận xét nào:

Đăng nhận xét