ReplaceImageValue

ReplaceImageValue[image,posval]
changes the pixel values at position pos in image to val.

ReplaceImageValue[image,posval,"type"]
assumes val to be of the specified type.

Details and OptionsDetails and Options

  • Pixel positions pos can be in one of the following forms:
  • {x,y}or {x,y,z}single position in 2D or 3D
    {xmin;;xmax,}span of positions
    {pos1,pos2,}a list of position specifications
    markerimagea marker image
  • ReplaceImageValue by default assumes the standard image coordinate system.
  • Other coordinate systems can be specified by setting the DataRange option. Typical settings include:
  • Automatic in 2D, in 3D
    Full in 2D, in 3D (default)
    {{left,right},{bottom,top}}explicit coordinate ranges in 2D
    {{left,right},{front,back},{bottom,top}}explicit coordinate ranges in 3D
  • Use ReplacePixelValue to specify exact pixel positions with integer indices.
  • The pixel value val can be a scalar, a list of channel values, or a color.
  • ReplaceImageValue[image,{pos1->val1,}] can be used to set pixel values for multiple positions.
  • When a position pos lies on a boundary between pixels, all adjacent pixels are modified.
  • ReplaceImageValue typically gives an image that has the same type as image.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Set a pixel in the center of the eye to white:

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

Set a list of pixels to black:

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

Set a list of pixels to a list of colors:

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

Set a pixel in the top-left front corner of a 3D image to gray:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2012
(9.0)
| Updated in 2014
(10.0)