---
title: ResizeAlgorithm
summary: Enables control over the resizing filter used to generate a new image with a higher or lower number of pixels.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/image_optimizer/enum.ResizeAlgorithm/
---

**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#612

```rust
pub enum ResizeAlgorithm {
    Nearest,
    Bilinear,
    Bicubic,
    Lanczos2,
    Lanczos3,
}
```

Enables control over the resizing filter used to generate a new image with a higher or lower
number of pixels.

## Variants

### Nearest

Uses the value of nearby translated pixel values.

### Bilinear

Uses an average of a 2x2 environment of pixels.

### Bicubic

Uses an average of a 4x4 environment of pixels, weighing the innermost pixels higher.

### Lanczos2

Uses the Lanczos filter to increase the ability to detect edges and linear features within
an image and uses sinc resampling to provide the best possible reconstruction.

### Lanczos3

Lanczos3 uses a better approximation of the sinc resampling function.

## Trait implementations

### impl Clone for ResizeAlgorithm

#### clone

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

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

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

### impl Debug for ResizeAlgorithm

#### fmt

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

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

**Parameters**

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

**Returns**

`$crate::fmt::Result`

### impl Serialize for ResizeAlgorithm

#### serialize

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

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

**Parameters**

- `self`: `&Self`
- `__serializer`: `__S`

**Returns**

`_serde::__private228::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>`
