This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ImageCompose

ImageCompose
gives the result of overlaying overlay onto image.
ImageCompose
gives the result of alpha blending overlay into image using blending fraction .
ImageCompose
places the center of overlay at position pos in image.
ImageCompose
places the point opos in overlay at position pos in image.
ImageCompose
uses the compositing fractions and the specified compositing mode.
  • ImageCompose always gives an image with the same pixel size as image.
  • ImageCompose does alpha blending if obj has an alpha channel.
  • ImageCompose effectively sets the alpha value for obj to , or multiplies an existing alpha channel by .
  • ImageCompose overlays obj pixel-by-pixel onto image, without changing the size of obj.
  • The object obj can be either an explicit image object, or a graphics object that is automatically rasterized to have the same image size as image.
  • The position pos in image, or the position opos in obj can be specified in the following ways:
{x,y}absolute pixel offset from the bottom-left corner
Scaled[{sx,sy}]scaled position from 0 to 1 across the object
{posx,posy}named and positions
  • If only one of and is given, the other is assumed to be Center.
  • The pixel offsets can be negative, indicating a point outside of image or obj.
  • ImageCompose yields an image with an alpha channel only if image has an alpha channel.
  • ImageCompose effectively adds an alpha channel with value to image.
  • ImageCompose combines a fraction of every pixel value in image with a fraction of every pixel value in obj, in all cases taking account of alpha channels.
  • With value for mode, obj is treated as on top of image. With value it is treated as underneath. And with value , image and obj are treated symmetrically.
  • The following choices of correspond to standard Duff-Porter compositing operators:
{1,1,1}object "over" image (default)
{0,1,1}object "atop" image
{1,0,1}object
{0,0,1}object "in" image
{1,1,0}"xor" operation
{0,1,0}image "out" object
{1,0,0}object "out" image
{0,0,0}"clear" image
{1,1,-1}image "over" object
{0,1,-1}image
{1,0,-1}image "atop" object
{0,0,-1}image "in" object
  • The "over" operators given by and effectively perform alpha blending.
  • The "in" operators given by and mask one image with the alpha channel of the other image.
  • The "out" operators and mask one image with the complement of the alpha channel of the other image.
  • The "atop" operators given by and effectively combine the alpha channels of the two images before performing alpha blending.
Overlay images that are partially transparent:
Specify an explicit position for the overlay:
Specify an alpha-blending parameter:
Overlay two partially transparent images:
Overlay images that are partially transparent:
In[1]:=
Click for copyable input
Out[1]=
 
Specify an explicit position for the overlay:
In[1]:=
Click for copyable input
Out[1]=
 
Specify an alpha-blending parameter:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
 
Overlay two partially transparent images:
In[1]:=
Click for copyable input
Out[1]=
Create a motion blur effect:
Explore the full range of alpha-compositing modes and parameters:
New in 7