The basic image merging operations defined by Porter and Duff in their 1984 paper, with a couple of additions. All these operations are methods of Image and return a new Image instance.
Each of the following operations is illustrated with these foreground and background images:
The image being operated on is the background image.
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Over(fg) |
Correlated Over operation. Similar to Over, but works better for correlated subpixel coverage.
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Cover(fg) |
Merge "atop".
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.MergeAtop(fg) |
Merge "in".
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.MergeXOR(fg) |
Merge XOR operation.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.MergeXOR(fg) |
Merge out operation.
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Out(fg) |
In this operation, the foreground acts as a color filter for the background.
fg
Foreground image (ice.Image).
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.TransmissionFilter(fg) |
Divide image by alpha channel.
Multiply image by alpha channel.