ImageSubtract

ImageSubtract[image, x]
subtracts a constant amount x from each channel value in image.

ImageSubtract[image1, image2]
gives an image in which each pixel is obtained by subtracting the values of the corresponding pixels in and .

DetailsDetails

  • The image returned by ImageSubtract[image, ...] has the same dimensions as image.
  • If the image dimensions are different, ImageSubtract[image1, image2] subtracts from the center of .
  • If or is a single-channel image, its values are subtracted from the values in each channel of the other image in ImageAdd[image1, image2].
  • If and are both multichannel images, the values in each channel are subtracted separately.
  • In ImageSubtract[image, x], the number x is normally in the range 0 to 1.
  • ImageSubtract[image, x] gives an image with the same underlying data type as image, clipping or truncating values if necessary.
  • In ImageSubtract[image, x], x can be a number, a color, or a list of color channel values.
  • ImageSubtract[image1, image2] gives an image with the largest type of either or , clipping or truncating values if necessary.
  • ImageSubtract works with Image3D objects.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Subtract a binary mask from a color photo:

In[1]:=
Click for copyable input
Out[1]=

Subtracting a constant amount from each color channel darkens an image:

In[1]:=
Click for copyable input
Out[1]=
New in 7 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »