bw
Converts an image to black and white (1-bit color).
Syntax
bw={value}bw={value},{luminance}Allowed values
| Value | Description |
|---|---|
threshold | Uses a luminance threshold to convert the image to black and white. |
atkinson | Uses Atkinson dithering to convert the image to black and white. |
Sub-parameters
| Param | Units | Description |
|---|---|---|
luminance | Number | Luminance 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
- The
luminancesub-parameter is only allowed when thevalueis set tothreshold. For example:bw=threshold,35. - The output produced when using
bwis not grayscale. It is true 1-bit color where every pixel is either black or white. - When using
bw, it is recommended to set theformatparameter toauto. 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 usage | Description |
|---|---|
?bw=threshold&format=auto | Convert the image to black and white using the threshold method and the default luminance value. |
?bw=threshold,75&format=auto | Convert the image to black and white using the threshold method with a luminance value of 75. |
?bw=atkinson&format=auto | Convert the image to black and white using Atkinson dithering. |