ReplaceImageValue

ReplaceImageValue[image, {x, y}->val]
changes the pixel values at position in image to val.

ReplaceImageValue[image, {xmin;;xmax, ymin;;ymax}->val]
changes the pixel values at positions that range from to to val.

ReplaceImageValue[image, {x, y}->val, "type"]
assumes val to be of the specified type.

Details and OptionsDetails and Options

  • ReplaceImageValue assumes the standard image coordinate system, where x runs from to width and y runs from to height. Image position corresponds to the bottom-left corner of the image. Other coordinate systems can be specified by setting the DataRange option.
  • Typical settings for DataRange include:
  • Automaticrange , where a is the aspect ratio
    {{left,right},{bottom,top}}explicit coordinate ranges
    Fulltrue pixel range
  • In 3D, ReplaceImageValue[image, {x, y, z}->val] assumes the standard 3D coordinate system, where x runs from to width, y runs from to depth, and z runs from 0 to height. The position corresponds to the bottom-left front corner.
  • Use ReplacePixelValue to specify exact pixel positions with integer indices.
  • In ReplaceImageValue[image, {x, y}->val], val can be a scalar, a list of channel values, or a color.
  • ReplaceImageValue[image, {{x1, y1}->val1, ...}] can be used to set pixel values for multiple positions.
  • ReplaceImageValue[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.
  • ReplaceImageValue[image, ...] typically gives an image that has the same type as image.
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »