6
$\begingroup$

I'm looking for a way to combine two images with standard image blending methods like Darken, Color Burn, Color Dodge, Soft Light. Is there a way to achieve these with ImageCompose or Overlay?

$\endgroup$

1 Answer 1

7
$\begingroup$

Use ImageApply with a list of images. You just need to get the formula right.

An example of "Screen" mode:

blend["Screen", u_, l_] := 1. - (1. - u)*(1. - l)
ImageBlend[mode_String, upper_Image, lower_Image] := 
 ImageApply[blend[mode, #1, #2] &, {upper, lower}]

An example to play with "Screen" mode:

lowerImg = ExampleData[{"TestImage", "Lena"}];
upperImg = 
  ImageAdjust@
   GaussianFilter[Image[RandomReal[1., ImageDimensions@lowerImg]], 
    4.];

ImageBlend["Screen", lowerImg, upperImg]

lena blended with noise

$\endgroup$
1
  • $\begingroup$ Can you add color dodge? $\endgroup$
    – M.R.
    Jan 8, 2019 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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