How does Photoshop or other image editing software change an images contrast? What does contrast mean when we process an image pixel by pixel? Or what does image contrast mean at all?

Here I created a very basic image to understand image contrast. This is a 10×10 pixels image that gets a 100% non-legacy contrast adjustment in Photoshop. The only change I saw was in gray colors that were lighter after applying the contrast.

Before and after contrast:

The images before and after contrasts are similar, except for the gray color which is slightly lighter


Actually, there are two very different algorithms in Adobe Photoshop CS3 or later.

The old one just shifts linearly the color of a pixel. The second one works proportionally. If your intent is to understand, in general, how contrast is applied, use the legacy contrast only. Here's an image showing a difference:

The new contrast shows no difference. The legacy contrast is very different from the original image.

When using legacy contrast, you see that it's much more intuitive from developers point of view. It actually lightens the dark pixels, and darkens the light ones when reducing the contrast. When increasing the contrast, you will see the same happening with gray color (turning lighter, then white at 100%), while blank and white staying the same.

From the point of view of photographers, on the other hand, this doesn't make any sense. As you can see below, when applied to real images, the new contrast algorithm has much better visual results than the old one:

enter image description here

enter image description here

See also:


Contrast is fairly simple. Increasing contrast means making bright pixels brighter and dark pixels darker; decreasing contrast is the opposite. So what you do is, per pixel: calculate the pixel's brightness, and move it toward or away from a center value (0.5 if your brightness range is 0 to 1).


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