ImageScan
✖
ImageScan
Details and Options

- The channel values supplied to f are normally in the range 0 to 1, regardless of the underlying type used in the Image object.
- ImageScan[f,image] discards the results of applying f to the pixels in image. Unlike ImageApply, ImageScan does not build up a new image and returns Null.
- ImageScan is useful in carrying out an operation on parts of expressions where the operation has a "side effect", such as making an assignment.
- ImageScan works on images with any number of channels.
- You can also use Throw to exit from ImageScan. »
- ImageScan traverses the pixels of image in a row-wise order from left to right.
- ImageScan has the option Interleaving, which specifies whether f should be applied to individual channel values or to the complete list of channel values for a given pixel. The default setting is Interleaving->True.
- With the setting Masking->roi, a region of interest to be scanned can be specified.
- ImageScan works with Image3D objects.
Examples
open allclose allBasic Examples (5)Summary of the most common use cases
Scan pixels of a grayscale image:

https://wolfram.com/xid/0enzd2s6c-dnik5q

https://wolfram.com/xid/0enzd2s6c-jlt884

https://wolfram.com/xid/0enzd2s6c-vno865
Count the number of white pixels in an image:

https://wolfram.com/xid/0enzd2s6c-6u9yga

https://wolfram.com/xid/0enzd2s6c-lby2ph


https://wolfram.com/xid/0enzd2s6c-wa4p1o

https://wolfram.com/xid/0enzd2s6c-gykosu

Generalizations & Extensions (1)Generalized and extended use cases
Options (4)Common values & functionality for each option
Interleaving (2)
By default, lists of channel values are scanned:

https://wolfram.com/xid/0enzd2s6c-racuwu
Using Interleaving->False, individual channel values can be scanned:

https://wolfram.com/xid/0enzd2s6c-q6zrb0
The interleaving setting does not affect the traversal of a single-channel image:

https://wolfram.com/xid/0enzd2s6c-nutx93

https://wolfram.com/xid/0enzd2s6c-6dgpt3
Masking (2)
By default, all image pixels are scanned:

https://wolfram.com/xid/0enzd2s6c-in8vnm

Scan only the pixels specified by the mask:

https://wolfram.com/xid/0enzd2s6c-pmojdk

Compute the mean color of the Spikey:

https://wolfram.com/xid/0enzd2s6c-7e50qn

Create a disk of the computed mean color:

https://wolfram.com/xid/0enzd2s6c-ot4yyo

Mean color computed without masking:

https://wolfram.com/xid/0enzd2s6c-u3vli9

Properties & Relations (1)Properties of the function, and connections to other functions
ImageScan does the same as ImageApply, but without returning a result:

https://wolfram.com/xid/0enzd2s6c-54c0y8

https://wolfram.com/xid/0enzd2s6c-svhosm

Wolfram Research (2012), ImageScan, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageScan.html.
Text
Wolfram Research (2012), ImageScan, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageScan.html.
Wolfram Research (2012), ImageScan, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageScan.html.
CMS
Wolfram Language. 2012. "ImageScan." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageScan.html.
Wolfram Language. 2012. "ImageScan." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageScan.html.
APA
Wolfram Language. (2012). ImageScan. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageScan.html
Wolfram Language. (2012). ImageScan. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageScan.html
BibTeX
@misc{reference.wolfram_2025_imagescan, author="Wolfram Research", title="{ImageScan}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/ImageScan.html}", note=[Accessed: 19-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_imagescan, organization={Wolfram Research}, title={ImageScan}, year={2012}, url={https://reference.wolfram.com/language/ref/ImageScan.html}, note=[Accessed: 19-June-2025
]}