> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://uploadcare.com/docs/_mcp/server.

# Image compression

> Compress images on the fly with Uploadcare’s CDN to reduce file size while preserving visual quality across devices and platforms.

When processing images, the result is encoded to the new image on the fly.
The compression operations allow you to control this process.
The [format](#operation-format) and [quality](#operation-quality) operations
affect loading speed and visual quality.
The right balance of those helps improve conversions and bounce rates.

## Format \[#operation-format]

`-/format/:format/`

If any other [image processing operation](/docs/transformations/image/#image-transformations-list) is applied,
the default format is `auto` (see [how `auto` works](#operation-format-auto)).

Alternatively, you can use the `-/format/` operation to convert an image
to one of the following formats:

* `jpeg` is a lossy image format (good compression for photos). JPEG doesn't
  support an alpha channel; hence you can use the
  [`setfill`](/docs/transformations/image/resize-crop/#operation-setfill) operation that sets a background
  color. All browsers support JPEG.
* `png` is a lossless format (good compression only for graphics) with
  alpha channel support. All browsers support PNG.
* `webp` is a modern format with more efficient compression than JPEG and with
  alpha channel support. It works well for all images, yet [not all](https://caniuse.com#feat=webp)
  browsers and OSs support it.
* `auto` the **default** behavior; is an automatic image format selection based on
  alpha channel presence and a client's device and browser.
* `preserve` returns the image in the original format if it is PNG or JPEG,
  otherwise coerces to PNG or JPEG. This option is useful
  when you need to save the image, rather than display it to the end-user.

### How `auto` works and prioritize image formats \[#operation-format-auto]

First, the algorithm checks the `Accept` header with MIME types to figure out
what image format a client browser supports.

* AVIF is used as output when all the following conditions are met:
  * `image/avif` MIME type is supported by the client.
  * Output image resolution is under the threshold (currently 2 MPx).
* WebP is used when `image/webp` MIME type is supported by the client.
* PNG is used when the source image contains an alpha channel with non-opaque pixels
  or when the image has limited color diversity, resembling artwork.
* JPEG is used otherwise.

You can disable the selection of modern formats, specifically AVIF and WebP,
for your project in the Dashboard. Alternatively, you may consider adding the
[`-/format/preserve/`](#operation-format) operation to a specific URL.

Note: `auto` works when you use primary Uploadcare [storage](/docs/uploads/storage/) (not S3
Bucket) and the default [Uploadcare Image CDN](/docs/delivery/) domain `ucarecdn.com`.

<table>
  <tr>
    <td>
      [![PNG image with transparency](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/png/)](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/png/)

      \


      400x301 `png` 116Kb\

      Transparent
    </td>

    <td>
      [![JPEG image, opaque](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/jpeg/)](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/jpeg/)

      \


      400x301 `jpeg` 16Kb\

      Opaque
    </td>

    <td>
      [![WEBP image with transparency, 10 times smaller file size than PNG](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/webp/)](https://ucarecdn.com/6ad747ff-dda6-4508-8864-5fc83f7fe645/-/setfill/ece3d2/-/format/webp/)

      \


      400x301 `webp` 15Kb\

      Transparent, size is equal\

      to the opaque one.
    </td>
  </tr>
</table>

Browsers that support WebP will load this image version, while others will
display JPEG or PNG instead.

## Quality \[#operation-quality]

`-/quality/:value/`

Sets output quality for [lossy formats](https://en.wikipedia.org/wiki/Lossy_compression) (JPEG, WebP, and AVIF).
Since actual settings vary from codec to codec and, more importantly, from format
to format, we provide five simple tiers that are consistent across
different formats and other settings and suit most cases of image distribution.

A higher quality level will typically result in a larger output file.
However, setting the quality level higher than the original level of the
uploaded image won’t increase your file size.

* `normal`: the **default** behavior when no `quality` operation is applied.
  The reasonable quality for 1x pixel density.
* `better`: can be used to render relatively small and detailed previews. ≈125%
  file size compared to `normal`.
* `best`: can be used to deliver images close to their pristine quality
  (e.g., for artwork). ≈170% file size.
* `lighter`: useful when applied to relatively large images to save traffic
  without significant quality loss. ≈80% file size.
* `lightest`: highest compression ratio for high pixel ratio. ≈50% file size.

### Adaptive quality \[#smart-compression]

Adaptive quality is enabled for all images in your project to automatically apply intelligent compression.
Content-aware algorithms analyze each image to determine the maximum compression level that maintains visual quality, ensuring no noticeable artifacts.

Adaptive quality is enabled by default for projects created on or after August 4, 2025.

To use Adaptive quality:

* New projects: Add any [URL-based operation](/docs/transformations/image/#image-transformations-list) (for example, [`-/preview/`](/docs/transformations/image/resize-crop/#operation-preview)).
* Existing projects (created before August 4, 2025):
  1. Enable Adaptive quality in the Dashboard under [Delivery settings](https://app.uploadcare.com/projects/-/settings/#delivery).
  2. Add any [URL-based operation](/docs/transformations/image/#image-transformations-list).

## Optimizing for high pixel ratios \[#high-pixel-ratios]

A great approach for high pixel densities is to increase images resolution
and reduce quality at the same time. Compared to just increasing quality,
images will look clearer on all screens with nearly the same file size.
To adjust quality, you can use `lighter` and `lightest` presets.

<table>
  <tr>
    <td>
      [![Best quality, max file size](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/220x220/-/quality/best/)](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/220x220/-/quality/best/)

      \


      1x `best` 16Kb\

      Blurry on retina.
    </td>

    <td>
      [![Smaller file size for all screens](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/330x330/-/quality/lighter/)](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/330x330/-/quality/lighter/)

      \


      1.5x `lighter` 14Kb\

    </td>

    <td>
      [![Even smaller file size, useful for retina](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/440x440/-/quality/lightest/)](https://ucarecdn.com/c5b7dd84-c0e2-48ff-babc-d23939f2c6b4/-/preview/440x440/-/quality/lightest/)

      \


      2x `lightest` 12Kb\

      Perfect for all screens.
    </td>
  </tr>
</table>

## Progressive JPEG \[#operation-progressive]

`-/progressive/yes/`\

`-/progressive/no/`

Returns a progressive image. In progressive images, data are compressed in
multiple passes of progressively higher detail. This is ideal for large images
that will be displayed while downloading over a slow connection allowing a
reasonable preview after receiving only a portion of the data.
The operation does not affect non-JPEG images; does not force image formats
to `JPEG`.

<table>
  <tr>
    <td>
      [](https://ucarecdn.com/ec8850a1-7d02-4af0-ad92-dbac0d169408/-/preview/-/quality/best/)

      \


      Baseline loading.
    </td>

    <td>
      [](https://ucarecdn.com/ec8850a1-7d02-4af0-ad92-dbac0d169408/-/preview/-/quality/best/-/progressive/yes/)

      \


      Progressive loading.
    </td>
  </tr>
</table>

## Strip meta information \[#meta-information-control]

`-/strip_meta/all/`\

`-/strip_meta/none/`\

`-/strip_meta/sensitive/`

The original image often comes with additional information built into the image
file. In most cases, this information doesn't affect image rendering and thus
can be safely stripped from the processed images to reduce image weight.
Currently, you can only keep EXIF meta information. Other storage, such as XMP
or IPTC, will always be stripped when creating a new processed image version.

* `all`: the default behavior when no `strip_meta` operation is applied.
  No meta information will be added to the processed file.
* `none`: uses the EXIF from the original file.
  The orientation tag will be set to 1 (normal orientation).
* `sensitive`: uses the EXIF from the original file but skips geolocation.
  The orientation tag will be set to 1 (normal orientation).

If you need to restrict user access to EXIF information, please
[protect your images from editing](/docs/mutability/).

## Animated images optimization \[#gif]

Video files are much smaller than GIFs, without noticeable quality loss. Their
delivery to end users is much faster. Gif to video operation converts animated
image files, such as GIF, WebP, and HEIC, to video and transforms them on the
fly. Learn more about [animated images optimization](/docs/transformations/gif-to-video/).