Thursday, October 21, 2010

Pixel Perfection

Photoshop at the core of its coding is a pixel or bitmap editor. That is not to say there is not some powerful algorithmic Mojo going on under the hood. So what am I talking about there? There are two processes that generate graphic images, these are bitmap and vector graphics. The image above is what the big deal is all about. Both sides of the image have been enlarged the same amount. So why has the left side pixelated and the right has not. (As a side note the left side shows a good example of artifacting.) Earlier I had traced the logo with the pen tool in Photoshop to generate a vector mask that can be scaled without any distortion, pixilation or artifacting. So how does it do this. First here is an example of what the two mean:
To the right you can see an example of vector vs bitmap graphic. The lines are the same size yet the vector line is so much smother. When a pixel is enlarged it maintains its squareness is the best way to describe it without going all tech-geek.
Now having mentioned the g word, we are going to get into it in short order. A vector graphic uses mathematical equations to generate a path to which a line may be drawn. Take a point in space as a reference, give it an direction and magnitude and the resulting point is called the sense. The element between the starting point and the sense is a vector path. When the vector path is stroked it becomes a bitmapped line in Photoshop. This is a simple line, curves are another animal.
To make a sin wave as shown below the equation below the wave is applied.
What this equation does is generate coordinates based in input values at specific points on the graph where only one shape of line may connect the projected points. Take the projected numbers on the simple chart below. Of the five sets of numbers they define a specific path for the line to be generated.
So how does all the relate to Photoshop? Have you ever noticed that when you are scaling text it maintains shape and definition? Then if you rastorize the text layer then enlarge the text, it does not scale as well and will eventually pixelate. shapes are the same thing. That is the best explanation for the difference between bitmap and vector graphics. The next time you go dragging a pen handle to stretch a curved arc, just think about all the number crunching that is going on behind the scenes. 
Ok so I got s little techie on this post but it was a fun little look into the mind of Mr. Adobe.

Take car all... Doug

No comments: