Compositing
IceMan Reference Guide |
Compositing
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:
teapot.tif |
Alpha channel of "teapot.tif" |
tinbox.tif |
Alpha channel of "tinbox.tif" |
- ice.Image Over(fg)
- fg: Foreground image (ice.Image).
The image being operated on is the background image.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Over(fg)
- ice.Image Cover(fg)
- fg: Foreground image (ice.Image).
Correlated Over operation. Similar to Over, but works better for correlated subpixel coverage.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Cover(fg)
- ice.Image MergeAtop(fg)
- fg: Foreground image (ice.Image).
Merge "atop".
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.MergeAtop(fg)
- ice.Image In(fg)
- fg: Foreground image (ice.Image).
Merge "in".
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.In(fg)
- ice.Image MergeXOR(fg)
- fg: Foreground image (ice.Image).
Merge XOR operation.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.MergeXOR(fg)
- ice.Image Out(fg)
- fg: Foreground image (ice.Image).
Merge out operation.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.Out(fg)
- ice.Image TransmissionFilter(fg)
- fg: Foreground image (ice.Image).
In this operation, the foreground acts as a color filter for the background.
fg = ice.Load('teapot.tif') bg = ice.Load('tinbox.tif') result = bg.TransmissionFilter(fg)
- ice.Image AlphaDivide()
- Divide image by alpha channel.
- ice.Image AlphaMultiply()
- Multiply image by alpha channel.