---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---

# `ResizeFilter`

Enumerator options for [`imageOptimizerOptions.resizeFilter`](./imageOptimizerOptions.mdx).

## Constants

- `Nearest` (`"nearest"`) Uses the value of nearby translated pixel values.
- `Bilinear` (`"bilinear"`) Uses an average of a 2x2 environment of pixels.
- `Linear` (`"linear"`) Same as `Bilenear`.
- `Bicubic` (`"bicubic"`) Uses an average of a 4x4 environment of pixels, weighing the innermost pixels higher.
- `Cubic` (`"cubic"`) Same as `Bicubic`.
- `Lanczos2` (`"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"`) Lanczos3 uses a better approximation of the sinc resampling function. (Default)
- `Lanczos` (`"lanczos"`) Same as `Lanczos3`.

## Examples

```js
import { ResizeFilter, Region } from 'fastly:image-optimizer';

addEventListener("fetch", (event) => event.respondWith(handleRequest(event)));

async function handleRequest(event) {
  return await fetch('https://www.w3.org/Graphics/PNG/text2.png', {
    imageOptimizerOptions: {
      region: Region.UsEast,
      width: 2560,
      resizeFilter: ResizeFilter.Linear
    },
    backend: 'w3'
  });
}
```