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

# `Optimize`

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

## Constants

- `Low` (`"low"`) Output image quality will be similar to the input image quality.
- `Medium` (`"medium"`) More optimization is allowed. We attempt to preserve the visual quality of the input image.
- `High` (`"high"`) Minor visual artifacts may be visible. This produces the smallest file.

## Examples

```js
import { Optimize, 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,
      optimize: Optimize.High
    },
    backend: 'w3'
  });
}
```