# graphics - Overlaping Image in red and green scale, mixing pure colors

How can I overlap/merge two density plot (in attach) using Mathematica. One image is in red scale and the other is in green scale.

In theses two images the lowest value is white (background) and the highest values are represented by pure red [ RGB (255,0,0) ] and green [ RGB (0,255,0) ] scale.

How do I to overlap these two images such that intersections are a combination of red and green to give a yellow intensity [ RGB (255,255,0) ] dependent on the "red" and "green" values. In summary I need that resultant image had red, green and yellow colors.

and the function Blend[{ Image1 , Image2 }], but I didn't get a good result.

This is the closest example that I get using Blend[{imag1,imag2}].

But this is not 100 % correct a time that if you combine two pure colors, pure red and green, I was expecting that the combination of these two pure colors result a image that had red, green and yellow colors, but not in the dark tone of these color.

• Could you show the code you used to create the above images in Mathematica? Or are they imported from somewhere else? In other words are you wanting to treat external data (like fluorescence microscopy images) or are you wanting to do everything inside Mathematica (also the creation of the images)? – Dunlop Nov 14 '16 at 11:42
• This images are from a external data. I would like to treat this images using Mathematica. – G. Candiotto Nov 14 '16 at 11:53
• ImageCompose[img, {img2, 0.5}] is, I think, the way to go but it doesn't necessarily result in a "nice" scale of yellow colors. – C. E. Nov 14 '16 at 12:02
• When you use this function ImageCompose[img, {img2, 0.5}] you obtain the same result of Blend[img , img2] this result is like a average of interpolation of the two images. The image that result from these two function ImageCompose[img, {img2, 0.5}] and Blend[img,img2] has a color tone /2 from the pure yellow – G. Candiotto Nov 14 '16 at 12:08
• @G.Candiotto . Hard to say but it looks from a first glance that the intensities are identical. If you combine both "red" and "green" images and then use ColorSeparate[] you end up with only the blue channel having less than a full intensity (except where the black lines are). Do you know where you are expecting the images not to match up, or have an example of what the output should be like? – Dunlop Nov 14 '16 at 13:35

Assuming the images are aligned and the same size, you can apply Max (or any other function) to each pixel color component like this:

imgs = Import /@ {"https://i.stack.imgur.com/aFlhC.png",
"https://i.stack.imgur.com/ez2ql.png"};


• @G.Candiotto: You can use any function instead of Max. But you'll have to come up with a function yourself - I have no idea what kind of mapping you have in mind. – Niki Estner Nov 14 '16 at 13:50
imgs = Import /@ {"https://i.stack.imgur.com/aFlhC.png",