Grayscale
Converts color image into shades of gray.
🖼️ Image options and parameters of grayscale
method
Grayscale filter, often called a black-and-white filter, is an image processing technique used to convert a colored image into a grayscale version. In a grayscale image, each pixel is represented by a single intensity value, typically ranging from 0 (black) to 255 (white), with various shades of gray in between. This process removes color information and retains only the brightness information of the image.


The grayscale filter essentially eliminates the color information from the image and retains only the luminance or brightness values. This type of image is often used in situations where color is not essential for understanding or conveying the visual information. Grayscale images can emphasize the tonal contrast and structural details of a scene, making them particularly useful for tasks like analyzing textures, patterns, and lighting conditions.
Kinds of images compatible with algorithm
Image property | What it means | Possible values |
---|---|---|
bitDepth | number of bits per channel | [8,16] |
components | number of components | [3] |
alpha | is alpha channel allowed | true |
Parameters and default values
options
Options
Property | Required | Default value |
---|---|---|
algorithm | no | luma709 |
keepAlpha | no | false |
mergeAlpha | no | true |
out | no | - |
List of grayscale algorithms:
-
max
: takes maximum value among of red,green and blue. -
min
: takes the minimum value of red,green and blue. -
average
: takes an average value of red,green and blue. -
minmax
: takes an average between the max and min values of red, green and blue. -
lightness
: takes lightness component of a pixel(alias ofminmax
). -
red
: takes a value of pixel's red channel. -
green
: takes a value of pixel's green channel. -
blue
: takes a value of pixel's blue channel. -
black
: takes the minimum of the inverses of red, green and blue. -
cyan
: takes cyan component of a pixel. -
magenta
: takes magenta component of a pixel. -
yellow
: takes yellow component of a pixel. -
hue
: takes hue component of a pixel. -
saturation
: takes a fraction from difference of minimum and maximum components of a pixel.