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.


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 Options


- ReplaceImageValue is typically used for image correction or annotation of 2D and 3D images by replacing image values at selected positions.
- ReplaceImageValue by default assumes position pos to be in the standard image coordinate system.
- 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 {xmin;;xmax;;xstep,…} span of positions with steps {pos1,pos2,…} a list of position specifications markerimage a marker image - 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.
- Use ReplacePixelValue to specify exact pixel positions with integer indices.
- Image value val can be in one of the following forms:
-
s a scalar color a color {s1,s2,…} a list of channel values - Possible settings for "type" include:
-
"Bit" integer 0 or 1 "Byte" integer 0 through 255 "Bit16" integer 0 through 65535 "Real32" single-precision real (32 bit) "Real64" double-precision real (64 bit) - Other coordinate systems can be specified by setting the DataRange option. Typical settings include:
-
Automatic {{0,1},{0,h/w}} in 2D, {{0,1},{0,d/w},{0,h/w}} in 3D Full {{0,w},{0,h}} in 2D, {{0,w},{0,d},{0,h}} in 3D (default) {{left,right},{bottom,top}} explicit coordinate ranges in 2D {{left,right},{front,back},{bottom,top}} explicit coordinate ranges in 3D - ReplaceImageValue typically gives an image that has the same type as image.

Examples
open all close allBasic Examples (3)
Scope (15)
Data (4)
Position (6)
Replace image values at multiple positions:
Replace multiple image values:
Use Span to replace multiple image values:
Value (3)
Options (5)
DataRange (5)
Replace image values sampled on a circle using a normalized data range:
Replace values sampled on a circle in an image with a non-unity aspect ratio using the default data range:
Use the Full data range:
Properties & Relations (5)
ReplaceImageValue only affects pixels inside the image:
Any position within the bounds of a pixel may be used:
Image values are set in the given order:
When coordinates correspond to a boundary between pixels, all surrounding pixels are replaced:
Read set pixels using ImageValue with "Nearest" resampling and "Fixed" padding:
Related Guides
Text
Wolfram Research (2012), ReplaceImageValue, Wolfram Language function, https://reference.wolfram.com/language/ref/ReplaceImageValue.html (updated 2014).
CMS
Wolfram Language. 2012. "ReplaceImageValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ReplaceImageValue.html.
APA
Wolfram Language. (2012). ReplaceImageValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ReplaceImageValue.html
BibTeX
@misc{reference.wolfram_2025_replaceimagevalue, author="Wolfram Research", title="{ReplaceImageValue}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ReplaceImageValue.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_replaceimagevalue, organization={Wolfram Research}, title={ReplaceImageValue}, year={2014}, url={https://reference.wolfram.com/language/ref/ReplaceImageValue.html}, note=[Accessed: 13-August-2025]}