---
title: BWMode
summary: Controls conversion of image to black and white duotone.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/image_optimizer/enum.BWMode/
---

**Kind:** Enum  
**Module:** [image_optimizer](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/image_optimizer/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/image_optimizer.rs#410

```rust
pub enum BWMode {
    Atkinson,
    DefaultThreshold,
    Threshold(u32),
}
```

Controls conversion of image to black and white duotone.

## Variants

### Atkinson

### DefaultThreshold

DefaultThreshold uses the default threshold value of 49.

### Threshold

- `0`: `u32`

Threshold can be between 0-100.

## Trait implementations

### impl Clone for BWMode

#### clone

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/image_optimizer.rs#409

```rust
fn clone(&self) -> Self
```

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

### impl Debug for BWMode

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/image_optimizer.rs#409

```rust
fn fmt(&self, f: &mut Formatter<'_>) -> Result
```

**Parameters**

- `self`: `&Self`
- `f`: `&mut $crate::fmt::Formatter`

**Returns**

`$crate::fmt::Result`

### impl Serialize for BWMode

#### serialize

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/image_optimizer.rs#422

```rust
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
    S: Serializer,
```

**Parameters**

- `self`: `&Self`
- `serializer`: `S`

**Returns**

`Result<S::Ok, S::Error>`

## Auto trait implementations

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Downcast`
- `DowncastSync`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `ToOwned`
- `TryFrom<U>`
- `TryInto<U>`
