> For the complete documentation index, see [llms.txt](https://weekerp.gitbook.io/image/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://weekerp.gitbook.io/image/resources/image.md).

# Image API

### **Image Processing**

The **Weekerp Image API** allows you to perform image transformations simply through URL parameters, including:

* **Resize** (width / height / size)
* **Format conversion** (JPEG, PNG, WebP, AVIF, etc.)
* **Quality adjustment** (quality)
* **Resize strategy** (fit)
* **Crop position** (position)

All processing is performed **on demand** at request time.\
The transformed result is cached at the CDN edge upon the first request,\
and all subsequent requests with the same parameters are served instantly from cache.

When the same image is requested again with identical parameters,\
the cached version is returned immediately — ensuring zero delay.

For more details, see the **Cache** documentation.

***

#### Base Request Format

```
https://cdn.weekerp.com/image/{source}/{path/to/image}.{ext}?{options}
```

***

#### Examples

| Description                        | Request URL                                                          |
| ---------------------------------- | -------------------------------------------------------------------- |
| Resize to 800px width, auto height | `https://cdn.weekerp.com/image/demo/photo.jpg?w=800`                 |
| Resize to 400×400 square           | `https://cdn.weekerp.com/image/demo/photo.jpg?w=400&h=400&fit=cover` |
| Compress to 70% quality            | `https://cdn.weekerp.com/image/demo/photo.jpg?w=1200&q=70`           |

***

#### Parameters

| Option     | Alias           | Description                   | Example                                                          |
| ---------- | --------------- | ----------------------------- | ---------------------------------------------------------------- |
| `size`     | `size`, `s`     | Set width and height together | `"800x600"`                                                      |
| `width`    | `width`, `w`    | Specify width in pixels       | `800`                                                            |
| `height`   | `height`, `h`   | Specify height in pixels      | `600`                                                            |
| `format`   | `format`, `f`   | Output format                 | `'webp'`, `'avif'`, `'jpg'`, `'png'`, `'gif'`, `'tiff'`, `'svg'` |
| `quality`  | `quality`, `q`  | Compression quality (1–100)   | `80`                                                             |
| `fit`      | `fit`           | Resize strategy               | `'cover'`, `'contain'`, `'fill'`, `'inside'`, `'outside'`        |
| `position` | `position`, `p` | Crop anchor position          | `'centre'`, `'top'`, `'bottom'`, `'left'`, `'right'`             |

***

#### Notes

* The **original image is never modified**.
* Transformed images are cached at the CDN edge and instantly served for identical requests.
* The default output format follows the original file’s extension,\
  but you can use the `f` parameter to convert formats (e.g., WebP, AVIF).\
  \<br>**Example:**\
  `https://cdn.weekerp.com/image/demo/photo.jpg?w=800&f=webp`

***

#### Recommendations

* The **maximum recommended response size** is **1MB** (current beta limitation).\
  For immediate processing needs, contact **<help@weekerp.com>**.
* Very large source images may fail during CDN processing.
* For high-capacity files, it’s recommended to serve them directly via the `/file` endpoint.


---

# 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://weekerp.gitbook.io/image/resources/image.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.
