({{, (RefLink[ImageFileScan, paclet:ref/ImageFileScan])[f,inputfile] 
applies the function f to the list of channel values for each pixel of the image stored in inputfile.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ImageFileScan, paclet:ref/ImageFileScan]) can be used to read and process successive pixel data from a very large image file whose size could exceed available memory.

The channel values supplied to f are normally in the range 0 to 1, regardless of the underlying type used in the (RefLink[Image, paclet:ref/Image]) object.

(RefLink[ImageFileScan, paclet:ref/ImageFileScan])[f,…] discards the results of applying f to the pixels. Unlike (RefLink[ImageFileApply, paclet:ref/ImageFileApply]), (RefLink[ImageFileScan, paclet:ref/ImageFileScan]) does not create a new file and returns (RefLink[Null, paclet:ref/Null]).

(RefLink[ImageFileScan, paclet:ref/ImageFileScan]) is useful in carrying out an operation on individual pixels where the operation has a "side effect", such as making an assignment.

(RefLink[ImageFileScan, paclet:ref/ImageFileScan]) works with TIFF, JPEG, and PNG files.

(RefLink[ImageFileScan, paclet:ref/ImageFileScan]) works on images with any number of channels.

The image file inputfile can be given as a string or a (RefLink[File, paclet:ref/File]) object.

(RefLink[ImageFileScan, paclet:ref/ImageFileScan]) traverses the image in a row-wise order from left to right.

You can use (RefLink[Throw, paclet:ref/Throw]) to exit from (RefLink[ImageFileScan, paclet:ref/ImageFileScan]). »

The following options can be given:

The following suboptions can be given to (RefLink[Method, paclet:ref/Method]):

The value of the option "MaxBlockSize" may be exceeded if it is smaller than the smallest block supported for the input file.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Compute the total intensity of an out-of-core image:

total=0;
ImageFileScan[total+=#&,ExampleData[{"TestImage","Man"},"FilePath"]];

total

Out-of-core image histogram:

counts=ConstantArray[0,256];
ImageFileScan[counts[[Clip[Floor[255#+.5]+1,{1,256}]]]++&,ExampleData[{"TestImage","Man"},"FilePath"]];

ListLinePlot[counts,Filling->0]

Compare with in-memory level computation:

counts==ImageLevels[ExampleData[{"TestImage","Man"}],"Byte"][[All,2]]

Compute the minimum and maximum values for each channel:

min={∞,∞,∞};
max=-{∞,∞,∞};
f[pixel_]:=(
min=MapThread[Min,{min,pixel}];
max=MapThread[Max,{max,pixel}];
);
ImageFileScan[f,ExampleData[{"TestImage","Apples"},"FilePath"]];
Transpose[{min,max}]

OpenersExampleSection1(Spacer1)Generalizations & Extensions  (1)

(RefLink[Throw, paclet:ref/Throw]) works inside (RefLink[ImageFileScan, paclet:ref/ImageFileScan]):

Catch[ImageFileScan[If[#<.1,Throw[#1]]&,ExampleData[{"TestImage","Man"},"FilePath"]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ImageScan, paclet:ref/ImageScan])  ▪  (RefLink[ImageFileApply, paclet:ref/ImageFileApply])  ▪  (RefLink[Scan, paclet:ref/Scan])  ▪  (RefLink[ImageFileFilter, paclet:ref/ImageFileFilter])  ▪  (RefLink[Import, paclet:ref/Import])  ▪  (RefLink[ImageData, paclet:ref/ImageData])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}, {▪(RefLinkPlain[3D Images, paclet:guide/3DImages])}})}})