Friday, September 21, 2007

Blending Mode Math

Colour in an RGB image is made of three colour channels (Red, Green, and Blue), each of which has a numerical value from 0-255 for any pixel in that image. RGB is an additive colour system. The colour black would have a value of zero, while white has a value of 255 for each pixel in each channel. You can see these numerical values displayed in the Info Palette (F8). 

The calculations for each of the RGB channels will be performed the same, so an examiner can look at one channel or all channels individually to verify his/her work.

Let’s begin with an example of how we’ll work with the math. Rather than use the more conventional terms of base layer and blend layer, I will instead try to make it a bit easire and use the terms upper and lower as a way to describe what we will be doing. For those who run away scared at mathematical formulae (or even the mere mention of math), I will follow each with an English explanation.

Example: X=U + L

For each pixel in the upper (U) and lower (L) layer, add each of the corresponding colour components together to form the X resulting pixel's colour. As described above, a pixel's colour value must always be between 0 and 255. 

Important tip: if X is equal to a negative value, then 0 is the result (Black). If X is equal to more than 255, then 255 is the result (White).

Normal Blending Mode
Normal is Photoshop’s default blending mode and has little to offer the forensic video analyst.

Normal: X=U

Simply put, the resulting pixel value is equal to the value of the upper layer’s pixel. Another way of looking at it is to say that the layer on top covers the layer or layers below.

Multiply Blending Mode (Alt+Shft+M)
Multiply can be used to quickly darken a bright image. How many times have we come across a video from a camera that was facing the sun or some other light source, opening the camera’s iris and washing out the resulting images? The images can be darkened quickly (Multiply is part of the Darken group) using a Multiply self blend. This effect can be performed on the whole image, or selectively using a layer mask.

Multiply: X = 1/255 (U*L)

Multiply mode multiplies the pixel values of the upper layer with those of the layer below it and then divides the result by 255. The result is usually a darker image. If either layer is white, the resulting image is the same as the other layer (1 * L = L). If either layer is black, the resulting image is completely black (0 * L = 0). Note: the mode is commutative; the order of the two layers doesn't matter.

In the next installment, we'll look at the Screen Blending Mode. Future postings will include a look at Soft Light and Difference Blending Modes as well as providing a list of references for further details on this complex subject.

2 comments:

areed said...

I think I may have found a solution:
I've inverted the upper layer (the layer with the multiply blend option applied & then used an adjustment layer above both U & L layers. The adjustment layer adjusts levels and a 235 negative offset is used (255 causes extreme posterization) to cross cancel the 255 scaling factor used in Photoshop's multiply.

areed said...

I think you may have missed my previous post.
I'd been trying to find a way to create a real divide blend between layers (U/L) The problem was that if multiply was used between a normal layer and one where the image had been first inverted, the division would still be affected by the 255 scaling factor.