yields True if image has the form of a binary Image or Image3D object, and False otherwise.


  • BinaryImageQ[image] tests that image is of type "Bit" and contains only a single channel of values.

Background & Context

  • BinaryImageQ is an image test function that returns True if a 2D or 3D image consists of binary data values only and False otherwise. More specifically, BinaryImageQ returns True only for single-channel images of ImageType "Bit". BinaryImageQ is therefore useful for distinguishing binary (or bi-level or two-level images) that assume possible pixel values of only 0 (black) and 1 (white) from images consisting of different data types and numbers of channels.
  • Some care is needed with terminology since the terms "black and white" and "monochrome" are sometimes used to refer to binary images, but more frequently used to mean grayscale images.
  • BinaryImageQ does not inspect actual data values. Therefore, while an image of type "Real" may contain only 0s and 1s, the image is not considered a "binary" image and BinaryImageQ will return False. BinaryImageQ will return True on the outputs for binary segmentation functions such as Binarize, MorphologicalBinarize, and RegionBinarize, since these functions all return binary images.
  • More details about the structure of an Image or Image3D can be obtained using the functions ImageChannels and ImageType. An expression can be tested to see if it is an image using ImageQ. The contents of an image are returned by ImageData.


open allclose all

Basic Examples  (4)

Test whether an image is binary:

Single-channel images with data type "Bit" are binary:

Image by default creates "Real" images:

Test whether a 3D image is binary:

Properties & Relations  (1)

Testing for a 2D binary image:

Testing for a 3D binary image:

Wolfram Research (2008), BinaryImageQ, Wolfram Language function, (updated 2012).


Wolfram Research (2008), BinaryImageQ, Wolfram Language function, (updated 2012).


Wolfram Language. 2008. "BinaryImageQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012.


Wolfram Language. (2008). BinaryImageQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_binaryimageq, author="Wolfram Research", title="{BinaryImageQ}", year="2012", howpublished="\url{}", note=[Accessed: 24-May-2024 ]}


@online{reference.wolfram_2024_binaryimageq, organization={Wolfram Research}, title={BinaryImageQ}, year={2012}, url={}, note=[Accessed: 24-May-2024 ]}