# Add two layers pixel-wise for all channels in Photoshop

Discussion in 'Photoshop Tutorials' started by d99alu, Jan 1, 2006.

1. ### d99aluGuest

Hi!

I'm looking for the simple operation to add two layers pixel-wise for
all channels in Photoshop (ver. 8). I find adjustments layers and
blending options for Multiply, Difference and so on, and I find
Arithmetic's for adding in gray scale and separate channels, but all I
want to do is just to add two layers pixel by pixel for all channels.
That is:
out_image = in_image_1 + in_image_2

I also would like to do the simple operation
out_image = input_image * k + m

I have been searching the net for quite some time, if anyone could give

me a hand here, that would be most appreciated.

regards,
Andreas Lundgren - Sweden

d99alu, Jan 1, 2006

2. ### Bill HiltonGuest

Andreas Lundgren writes ...
You can usually figure out a way to do operations this by getting the
actual formulas for the various blending modes and figuring out how to
apply them. For example, the formula for the "Add" mode is ((source 2
+ source 1)/scale) + offset => destination ... so with scale = 1 and
offset = 0 you'll get what you need ... access this command in
Photoshop CS with Image - Apply Image, the defaults for scale and
offset are already set to 1 and 0 ... this will do the trick.
Did you mean (input_image * k) + m or input_image * (k+m) ? Either way

I think you can figure this out with the blending mode formulas too,
though the straight 'multiply' command is ((source 1) x (source 2))/255

so you may need to combine multiple operations ... if you just multiply

without the divide-by-255 you'll quickly get far too much black ...
Hope this helps ... try to find a list of formulas for the blend modes
(I got mine from the "Photoshop Artistry" books) and realize you might
need to run two operations to get the result you want and it should
make sense.

Bill

Bill Hilton, Jan 1, 2006

3. ### Bill HiltonGuest

if you just multiply
oops, change 'black' to 'white'

Bill Hilton, Jan 1, 2006
4. ### d99aluGuest

Thanks Bill!

d99alu, Jan 1, 2006
5. ### Mike RussellGuest

Hi Andreas,

factor, which you may use, with a little trickery, to get your second
the scale value K and one without. The scale factor may also be used to
prevent overflow after an add operation.

You will need to repeat the calculation for each channel - record these
operations into an Action.

Mike Russell, Jan 1, 2006