11

I am trying to optimise a vector graphic so it does align well to pixels but if I try to align-to-pixel grid I loose too much from the quality and I still need to be able to snap with 0.5px increments.

How can I obtain this behaviour? … without loosing the pixel view feature.

3
  • 1
    Why not scale up your artwork to 200% and then every half pixel coordinate becomes a full pixel coordinate. You can then scale back down after.
    – Dom
    Commented Aug 23, 2013 at 13:24
  • 1
    The problem with this is that there is no such thing as a half-pixel. Any fraction of a pixel gets rounded up/down. You will want to choose an alternative unit of measurement.
    – Andrew
    Commented Aug 26, 2013 at 19:54
  • @Andrew Finally, a very useful comment, this means that I need to use pt and change the dpi so it will map 1:1, but at least it could be a float.
    – sorin
    Commented Aug 27, 2013 at 11:00

2 Answers 2

8

You can set up a a Grid in the Preferences to have a grid line every .5pt (same as px in AI). Then turn on Snap to Grid in the View Menu. This will allow you to snap to .5px increments. However, it is not going to matter.

While you can place an object at a 1/2 pixel (or 1/2pt in Illustrator), upon output everything is adjusted (anti-aliased) to full pixels. This can be seen by turning on Pixel Preview in the View menu.

For example... a 1/2 pixel square:

half pixel

And with Pixel Preview:

preview

You can see the half pixels are converted to full pixels upon output. Illustrator won't output artwork at half pixels.

Save that half pixel image... open in Photoshop and enlarge 3200%....

enlarged

All half pixels are going to be anti-aliased and treated this way upon output. Any effort you make to construct .5 pixel restrictions is going to be nullified by any output of the file since a single pixel is the smallest screen element.

But you probably are saying to yourself, "I only need some edges to sit on half a pixel. Not a half pixel image."

Well, edges will be anti-aliased to the nearest pixel as well...

edges

(Bottom edge rests on a half pixel. Black edge is a half pixel wide).

And Pixel Preview....

preview

Oh, but let's turn off "Anti-Alias Artwork" in Illustrator preferences and look at Pixel Preview then....

no anti-aliasing

The answer is really not to work at .5 pixels, but to alter the artwork so it looks correct at full pixels.

2
  • Wonderful answer and to your surprise it seems to fit my needs as what I wanted was to pe able to snap the direction points to 0.5 pixels while the anchor points are at full pixels.
    – sorin
    Commented Aug 23, 2013 at 11:26
  • Ahh.. snapping handles at 1/2 pixels while anchors are on full pixels makes perfect sense :)
    – Scott
    Commented Aug 23, 2013 at 13:46
2

Vectors might change the rules a bit in some specific cases, but generally speaking, there is no 0.5px increment. (Unless we're talking CSS px on retina devices, but that's a whole different topic)

A pixel is the smallest unit on a monitor.

enter image description here

In the above image, each set of one red, one green, and one blue light is a single pixel. The device tells the screen how to balance the brightness of those three colors one set (pixel) at a time in order for your eyes to percieve a given color. Your monitor doesn't consider units any smaller than that.


There are some borderline exceptions. Such as a border of a vector shape not perfectly aligning with pixels, so some sort of anti-aliasing occurs. Still not really any half pixel business going on by the time information gets to your monitor though. Also, with ultra HD devices such as modern smart phones, a px in CSS is no longer equal to one pixel. There's still no half a pixel, but on retina (ultra HD) devices, for conversation's sake, you can consider a pixel to be one a half a px is the pixel ratio is 2:1.

1
  • 1
    Thanks for the elaborate answer, still I have to say that it does not address my question. While I am fully aware about what a pixel is, I do also know that a vector image has floating point coordinates inside, so you can align them in any way. I guess that the solution is to disable snap-to-pixel and to create a grid that has snap points every 0.5px… this is what I was looking for.
    – sorin
    Commented Aug 22, 2013 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.