({{, (RefLink[ConstantImage, paclet:ref/ConstantImage])[val,size] 
gives an image of the specified size with constant pixel values of val.}, {, (RefLink[ConstantImage, paclet:ref/ConstantImage])[val,size,"type"]
gives an image converted to the specified type.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ConstantImage, paclet:ref/ConstantImage]) by default chooses a color space compatible with the given value specification val.

Constant value val can be any of the following:

Size specification size can be one of the following:

(RefLink[ConstantImage, paclet:ref/ConstantImage])[val] is equivalent to (RefLink[ConstantImage, paclet:ref/ConstantImage])[val,{150,150}]. »

The default "type" is taken to be "Real32".

The following options are supported:

OpenersPrimaryExamplesSection(Spacer1)Examples  (10)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create a constant gray image:

ConstantImage[0.6,{50,50}]

Create a constant color image:

ConstantImage[Red,{50,50}]

Create a constant 3D image:

Image3D[ConstantImage[Green,{10,10,10}],Boxed->True]

OpenersExampleSection1(Spacer1)Scope  (4)

Create a constant Lab image:

ConstantImage[LABColor[0.5,0.8,0.8],{50,50}]

ImageColorSpace[%]

Create a constant image with an arbitrary number of channels:

ConstantImage[{0.1,0.3,0.5,0.7,0.9},{50,50}]

ImageChannels[%]

If no output image size is specified, a 150×150 image is returned:

ConstantImage[Yellow]

ImageDimensions[%]

By default, an image of a real type is generated:

ConstantImage[Red,{50,50}]

ImageType[%]

Specify the output image type:

ConstantImage[Red,{50,50},"Byte"]

ImageType[%]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)ImageSize  (1)

By default, (RefLink[Automatic, paclet:ref/Automatic]) image size is used:

ConstantImage[,{50,50}]

Specify the (RefLink[ImageSize, paclet:ref/ImageSize]):

ConstantImage[,{50,50},ImageSize->100]

OpenersExampleSection3(Spacer1)Applications  (1)

Create a constant black image to construct a marker image:

i=;

zero=ConstantImage[0,ImageDimensions[i]]

Replace marker points with white and use for processing:

pts={{100,25},{40,75},{35,45}};
marker=ReplacePixelValue[zero,pts->1]

FillingTransform[i,marker]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Construct a constant image using (RefLink[ConstantArray, paclet:ref/ConstantArray]):

Image[ConstantArray[{1,0,1},{50,100}]]

ConstantImage[{1,0,1},{100,50}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[RGBColor, paclet:ref/RGBColor])  ▪  (RefLink[Image, paclet:ref/Image])  ▪  (RefLink[RandomImage, paclet:ref/RandomImage])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[ConstantArray, paclet:ref/ConstantArray])  ▪  (RefLink[LinearGradientImage, paclet:ref/LinearGradientImage])  ▪  (RefLink[Background, paclet:ref/Background])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Creating & Importing Images, paclet:guide/CreatingAndImportingImages])}})}})