I have two images
Bwhich are similar in many regions.
I want to create an image
B = C on top of A
Cshould be as transparent as possible.
on top ofis the normal layer superposition.
Cis some kind of difference between
Bare identical, then
Cis totally transparent. If
Bare very different, then their
Cwould be nearly identical to
You could use the “difference” layer mode to create a layer mask, and apply it to B like this:
- Open both images as layers, A on the bottom, B on top
- On the layer’s dialog, mark B’s layer mode as “difference”. You now
should see the image mostly black is the images are alike, with the
colored areas marking the areas that are different. These colors,
however, won’t match B’s colors as you want
- Edit->Copy visible, to get a copy of the calculated effect on B
- Duplicate Layer B, change it’s mode back to “Normal” (let’s call this layer C)
- On the Layers menu, add a layer mask to C (Layer->Mask->Add Layer Mask).
- With the mask selected, paste the contents copied in step 3 (edit->paste).
- Anchor the pasted contents on the layer’s mask (layer->Anchor layer)
There you are – make Layers A and B invisible, and you should be very close to what you want. Further operations on the layer mask (I recommend using Colors->curve) can adjust the opacity/transparency of the areas on layer C.
update I recently answered a similar question to this on Stackoverflow, where the OP wanted to perform the task programatically (Using Python + Python-imaging-library) – I’ve posted the full program on that question and it might be of help for anyone interested in this answer.