> For the complete documentation index, see [llms.txt](https://help.pixboost.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.pixboost.com/api/resize.md).

# Resize

API endpoint - `/api/2/img/[IMAGE-URL]/resize?size=[NEW-SIZE]`

## Description

**Resize** - resizes image with preserving aspect ratio and optimizes it using lossy compression. If you need the exact size then use fit operation.

## Parameters

**size** (**required**) - new size (in pixels) of the image in the format `WIDTH and xHEIGHT`. You can specify only one dimension and the second will be calculated according to the image's aspect ratio.

**dppx** (optional) - Number of dots per pixel defines the ratio between device and CSS pixels. The query parameter is a hint that enables extra optimisations for high density screens. The format is a float number in the same format as window\.devicePixelRatio.

**trim-border**(optional) - Will remove the edges of the image with the same color, if the option specified.

### Examples

* `size=200` - resize to 200 px wide preserving aspect ratio
* `size=x80` - resize to 80 px high preserving aspect ratio
* `dppx=2` - sending a hint to the API that screen has DPI=2

| Parameters            |                                                                          Image                                                                          |
| --------------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------: |
| Original              |                         ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cup.jpeg/asis?auth=MTA0ODU5NDA0NQ__)                         |
| size=200              |                   ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cup.jpeg/resize?size=200\&auth=MTA0ODU5NDA0NQ__)                   |
| size=x80              |                   ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cup.jpeg/resize?size=x80\&auth=MTA0ODU5NDA0NQ__)                   |
| size=200\&dppx=2      |               ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cup.jpeg/resize?size=200\&dppx=2\&auth=MTA0ODU5NDA0NQ__)               |
| Original              |              ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cups/keep-calm-2816357__340.jpg/asis?auth=MTA0ODU5NDA0NQ__)             |
| size=200              |        ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cups/keep-calm-2816357__340.jpg/resize?size=200\&auth=MTA0ODU5NDA0NQ__)       |
| size=200\&trim-border | ![](https://pixboost.com/api/2/img/http://www.midday.coffee/assets/cups/keep-calm-2816357__340.jpg/resize?size=200\&trim-border\&auth=MTA0ODU5NDA0NQ__) |

**You can see URL of the examples by "right-click -> Copy Image address"**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.pixboost.com/api/resize.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
