bw

Converts an image to black and white (1-bit color).

Syntax

bw={value}
bw={value},{luminance}

Allowed values

ValueDescription
thresholdUses a luminance threshold to convert the image to black and white.
atkinsonUses Atkinson dithering to convert the image to black and white.

Sub-parameters

ParamUnitsDescription
luminanceNumberLuminance threshold between 0 and 100. Determines the cutoff point for when pixels are rendered as black or white. A higher value produces a darker image.

Notes

  1. The luminance sub-parameter is only allowed when the value is set to threshold. For example: bw=threshold,35.
  2. The output produced when using bw is not grayscale. It is true 1-bit color where every pixel is either black or white.
  3. When using bw, it is recommended to set the format parameter to auto. This helps ensure the image produced has the smallest file size by using lossless compression. Lossy output with 1-bit color may introduce compression artifacts and also increase the file size of the image.

Examples

Click the link to view the transformed image using a demo Fastly IO service.

Example usageDescription
?bw=threshold&format=autoConvert the image to black and white using the threshold method and the default luminance value.
?bw=threshold,75&format=autoConvert the image to black and white using the threshold method with a luminance value of 75.
?bw=atkinson&format=autoConvert the image to black and white using Atkinson dithering.