ReplacePixelValue

ReplacePixelValue[image, {xp, yp}->val]
changes the pixel values at pixel position in image to val.

ReplacePixelValue[image, {xpmin;;xpmax, ypmin;;ypmax}->val]
changes the pixel values at the pixel positions that range from to to val.

ReplacePixelValue[image, {xp, yp}->val, "type"]
assumes val to be of the specified type.

DetailsDetails

  • In ReplacePixelValue[image, {xp, yp}->val], the pixel position with assumed to be in the standard image coordinate system, where the values of x range from to width and y from to height.
  • Integer pixel positions correspond to the centers of pixels with representing the center of the pixel at the bottom-left corner.
  • In 3D, pixel position corresponds to the center of the bottom-left front pixel.
  • In ReplacePixelValue[image, {x, y}->val], val can be a scalar, a list of channel values, or a color.
  • ReplacePixelValue[image, {{x1, y1}->val1, ...}] can be used to set pixel values for multiple positions.
  • ReplacePixelValue[image, {{x1, y1}, ...}->val] sets the pixel values for all specified positions to val.
  • When the coordinate lies on a boundary between pixels, all adjacent pixels are modified.
  • ReplacePixelValue[image, {x, y}->val] typically returns an image of the same type as the input image.
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »