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 image1 and image2.

ImageSubtract[image,expr1,expr2,]

subtracts all expri from image, where each expri can be either an image, a number, or a color value.

Details

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

Examples

open allclose all

Basic Examples  (3)

Subtract a binary mask from a color photo:

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

Subtracting two 3D images:

Applications  (2)

Subtract complimentary primary colors:

Create an unsharp mask by subtracting a blurred version:

Add the unsharp mask to the original image:

Wolfram Research (2008), ImageSubtract, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageSubtract.html (updated 2014).

Text

Wolfram Research (2008), ImageSubtract, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageSubtract.html (updated 2014).

CMS

Wolfram Language. 2008. "ImageSubtract." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ImageSubtract.html.

APA

Wolfram Language. (2008). ImageSubtract. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageSubtract.html

BibTeX

@misc{reference.wolfram_2024_imagesubtract, author="Wolfram Research", title="{ImageSubtract}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ImageSubtract.html}", note=[Accessed: 10-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagesubtract, organization={Wolfram Research}, title={ImageSubtract}, year={2014}, url={https://reference.wolfram.com/language/ref/ImageSubtract.html}, note=[Accessed: 10-December-2024 ]}