# Convert formats

`formats` adds a copy in each format next to the original. The original stays in its own format.

```json [lumen.config.json]
{
  "formats": ["webp", "avif"]
}
```

## Choose a format

| Format | Use it for | Browser support |
| --- | --- | --- |
| WebP | Photos and graphics on every site | Every current browser |
| AVIF | The smallest photos, when encode time does not matter | Every current browser |
| JPEG | Email and old clients | Every client |

> **Tip**

AVIF takes about ten times longer to encode than WebP. Turn it on for the images of a release build, not for each save in development.

## Convert PNG photos

A photo saved as PNG is often five times larger than the same photo as JPEG. `--photos-to-jpeg` converts a PNG to JPEG when it has no transparent pixels and more than 10,000 colors.

```bash [Terminal]
lumen convert ./public --photos-to-jpeg
```

Lumen prints each file that it converted, so you can update the links to it.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://docs-demo.vitehub.dev/raw/docs/guides.md)
- [Transform](https://docs-demo.vitehub.dev/raw/docs/guides/resize.md)
- Optimize
  - [Compress images](https://docs-demo.vitehub.dev/raw/docs/guides/compress.md)
  - [Convert formats](https://docs-demo.vitehub.dev/raw/docs/guides/formats.md) (this page)
- [Check images in CI](https://docs-demo.vitehub.dev/raw/docs/guides/ci.md)

Next: [Presets](https://docs-demo.vitehub.dev/raw/docs/guides/presets.md)

All pages: [llms.txt](https://docs-demo.vitehub.dev/llms.txt)
