---
title: "Optimises a source image"
method: GET
path: "/img/{imgUrl}/optimise"
tags: ["images"]
---

# Optimises a source image

`GET /img/{imgUrl}/optimise`

Optimises an image and returns it in the next-gen format supported 
by the browser. The API knows about supported formats through the "Accept"
header.

## Path parameters

- `imgUrl` string, required

## Query parameters

- `dppx` number, float
- `save-data` 'off' | 'hide'
- `trim-border` boolean

## Response `200`

An optimised image

## Changes

- **2023-12-29** `cad07fafe731` — 2 info
  - the `query` request parameter `dppx` became optional
  - the `query` request parameter `save-data` became optional
- **2023-12-19** `18cbc1c76caa` — 1 info
  - added the new optional `query` request parameter `trim-border`
- **2023-07-20** `f053d6fb3a38` — 1 info
  - added the media type `image/jxl` for the response with the status `200`
- **2022-03-04** `a3e4afa484da` — 2 info
  - added the media type `image/avif` for the response with the status `200`
  - added the media type `image/webp` for the response with the status `200`
- **2022-02-28** `ac53f9796a01` — 5 breaking, 1 warning
  - the `query` request parameter `dppx` became required
  - the `query` request parameter `save-data` became required
  - removed the media type `image/avif` for the response with the status `200`
  - removed the media type `image/jxl` for the response with the status `200`
  - …2 more

[Change history](https://skmtc.dev/pixboost/apis/image-cdn-api-for-web/changes/img/:imgUrl/optimise/get.md)

---

[API](https://skmtc.dev/pixboost/apis/image-cdn-api-for-web.md) · [All operations](https://skmtc.dev/pixboost/apis/image-cdn-api-for-web/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pixboost/image-cdn-api-for-web/revisions/b1380a4d73ae/schema)
