Tuesday, August 17, 2010

Dealing with Pixel Density and Brush Performance


I regularly receive emails asking about brush performance in applications like Photoshop and Painter. Lately, I've been asked about the resolution of imagery used in my lynda.com training titles. I thought it would be useful to provide some explanation here so that it is available to a larger audience.

The lynda.com recordings done in the booth were generally done at screen resolution, but a real-world situation will often require higher resolutions. For example, offset printing generally dictates files at 300ppi (pixels per inch). Inkjet printing is often discussed in terms of 240ppi. For web-based viewing, imagery at 72ppi is considered acceptable. You can easily determine the pixel resolution of an image by multiplying the size in inches by the above ppi (pixels per inch) factors.

Let's use a typical real-world size as an example: 20" X 24". This is a common photographic print and frame size.

20" X 24" @ 72ppi = 1440p X 1728p = 2,488,320 pixels
20" X 24" @ 150ppi = 3000p X 3600p = 10,800,000 pixels
20" X 24" @ 300ppi = 6000p X 7200p = 43,200,000 pixels

Note that each of these resolution factors quadruples the total pixel count—as resolution increases, so does pixel density.

It is the density of pixels being manipulated that dictates both application and brush performance. With this in mind, we can state that performance will decrease as image pixel density increases. A one inch square of a 300ppi image is far more pixel-dense than a one inch square of a 72ppi image. There are three primary factors that affect an application's ability to handle large pixel-based manipulation.

Processor Speed
The faster the processor, the better the performance. Additionally, today's processors generally contain multiple cores. This is akin to having multiple copies of the processor available to simultaneously handle various tasks. Photoshop is multi-core aware and can take advantage of multiple cores when present. Photoshop generally performs better on newer machines because of this.

RAM Memory
Manipulating pixels is a memory-intensive application. In order to process pixels efficiently, Photoshop uses temporary memory containers—a scratch disk or cache—to hold pixels while processing calculations on them. When Photoshop runs out of RAM memory—which is fast because it is just electrons—it resorts to virtual memory, an allocation of physical disk space. This virtual memory is slower because it is a physical medium. It is for this reason that more RAM will improve Photoshop performance. It is often stated that the cheapest way to speed up a computer is to add RAM and this certainly holds true for Photoshop.

Graphics Card
Graphics cards have an onboard GPU (graphics processor unit) that is designed to specifically handle sophisticated pixel-based calculations. GPUs initially gained popularity to improve 3D game performance, but have evolved to become an important secondary processor for applications like Photoshop. CS5 specifically targets the GPU for a variety of tasks and this trend will continue in the future. As a result, higher performance graphics cards improve Photoshop's pixel handling.

Now let's look at a comparison of two systems. I'm currently using a 2.4Ghz MacBook Pro and I often find my brush performance wanting—as brush sizes get larger (a.k.a. pixel density), there is a decided lag in the drawing of the stroke. When I recorded the Mixer Brush title at lynda.com, I used their machine, which was a 2 x 3Ghz Quad-Core Intel Xeon Mac Pro—this machine easily handled anything I could throw at it (I probably could have taxed it with very large brush sizes).

Having been in the software development business, I can tell you that applications are generally developed on the then-current fastest processors. This ensures that the resulting app will run well on future, faster processors. The down side, of course, is that many users have older machines and will experience less-than-ideal performance.

There are two short-term fixes for this scenario. One is to use brush size as a performance throttle. The idea behind this is to adjust brush size down until you get acceptable painting performance. The caveat here is that you may find that the largest acceptable brush size—performance-wise—is not acceptable for your style.

The other performance enhancer is to add more RAM memory to your system. Photoshop is a memory-intensive app. When it runs out of RAM, it resorts to virtual memory, which is an allocation of your disk space as a "scratch disk". Because this is disk-based memory, it is obviously slower than physical RAM. So, an increase in RAM will enable Photoshop to do more work before resorting to the scratch disk. I've maxed my Mac Pro out to 6GB RAM for this reason and it definitely helps—but don't expect it to be a miracle cure for a dated processor. I recommend Other World Computing as a source of RAM upgrades—their prices are good and they supply quality RAM.

The ultimate solution is a current high-performance machine. Be aware that the merry-go-round never stops spinning and today's flame thrower will eventually become tomorrow's boat anchor. Riding the crest of technology requires periodic hardware upgrades.

2 comments:

  1. This still is my main gripe with painter (I'm on Painter11 on OSX on a 2.4GHz iMac with 4gig Ram), it seems to me that there were no real brush engine improvements done for a looong time...
    Don't get me wrong, I still love the program despite of all its quirks.
    I really hope there will be an overhaul of the engine some time, it can be done, look i.e. at TV Paint or some of the japanese painting programs. I just recently tried Painter on a super fast Mac Pro and you still get lags etc very easily.

    ReplyDelete
  2. true, painters brushes rock, thankyou John for the effort you put in, but Photoshop has the same problem with lag in CS5,even on quadcore, i`ve used TV paint when it was with "mirage" and rendered strokes quickly, although some of these painter strokes are very complicated and do take some time, but that lag/drag really dulls the brainstorm inspiration of painting and sketching. hopefully the engine gets a lot of focus next,

    ReplyDelete