# Image API and MCP server

> Everything the site does, as an API. Compress to an exact file size, convert between formats, remove backgrounds and optimize a whole web page, from your code or from your AI agent.

Get an API key: https://imagecompressor.si/account/keys · HTML: https://imagecompressor.si/developers · OpenAPI: https://imagecompressor.si/api/v1/openapi.json

## Quick start

Send the image as the request body and get the result back as the response body.

```bash
curl -X POST "https://imagecompressor.si/api/v1/compress?format=webp&target_bytes=100000" \
  -H "Authorization: Bearer $IMAGECOMPRESSOR_API_KEY" \
  --data-binary @photo.jpg \
  -o photo.webp
```

## The same call in three languages

```js
import { ImageCompressor } from "@imagecompressor/sdk";
import { readFile, writeFile } from "node:fs/promises";

const client = new ImageCompressor({ apiKey: process.env.IMAGECOMPRESSOR_API_KEY });
const result = await client.compress(await readFile("photo.jpg"), {
  format: "webp",
  targetBytes: 100000,
});
await writeFile("photo.webp", result.data);
```

```python
import os
from imagecompressor import ImageCompressor

client = ImageCompressor(os.environ["IMAGECOMPRESSOR_API_KEY"])
with open("photo.jpg", "rb") as handle:
    result = client.compress(handle.read(), format="webp", target_bytes=100000)
result.save("photo.webp")
```

## SDKs and command-line tool

Official clients with no dependencies: TypeScript/JavaScript and Python. The JavaScript package also installs the imagecompressor command for terminals and build scripts.

```bash
npm install @imagecompressor/sdk     # the client and the imagecompressor command
pip install imagecompressor          # the Python client

export IMAGECOMPRESSOR_API_KEY=ic_live_...
imagecompressor compress photos/ --recursive --out optimized
imagecompressor pipeline products/ --preset product-square
```

## Endpoints

Response headers: X-IC-Original-Bytes, X-IC-Bytes, X-IC-Width, X-IC-Height, X-IC-Format, X-IC-Outcome, X-IC-Warnings and X-IC-Duration-Ms (processing time).

### POST /api/v1/compress

Compress, convert, resize, crop, rotate, edit or watermark an image.

Options combine freely. Order: orient, crop, flip, rotate, resize, colour adjustments, pad, circle mask, border, watermark, encode.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `format` (auto | jpeg | png | webp | avif | gif | tiff | bmp | ico | jxl | pdf | tga | psd, default auto): Output format. auto keeps the input format. ico holds the image at 16 to 256 pixels, on a square.
- `mode` (quality | smart | lossless | keep | target, default quality): smart finds the smallest file that still looks like the original; lossless keeps every pixel; keep does not compress: an image the request leaves unchanged comes back as it was with only its metadata removed, a changed one at full quality.
- `quality` (integer, 1–100, default 75): Used by mode quality.
- `target_bytes` (integer, 1–1000000000): Compress to at most this many bytes.
- `min_bytes` (integer, 1–1000000000): Make a JPEG or PNG result at least this many bytes, by padding the file without changing the picture. With target_bytes it gives a range. Other formats get the warning min_size_unavailable.
- `crop` (string): x,y,width,height in pixels, before flip and rotate.
- `crop_ratio` (string): Crop to this shape.
- `crop_gravity` (centre | attention | face, default centre): Where a crop_ratio crop is taken from. face: around the faces found, with room above the head; without a face, as attention, with the warning no_face_found.
- `crop_shape` (rect | circle, default rect): circle clears everything outside the ellipse.
- `flip` (none | h | v | hv, default none): Mirror horizontally, vertically or both.
- `rotate` (integer, -359–359, default 0): Degrees clockwise. Not a quarter turn: the image grows to hold the turned picture and its new corners are transparent (the background colour in JPEG and BMP).
- `width` (integer, 1–100000): Target width in pixels.
- `height` (integer, 1–100000): Target height in pixels.
- `percent` (integer, 1–1000): Scale, when neither width nor height is given.
- `fit` (inside | exact | cover | contain, default inside): inside keeps the ratio, exact stretches, cover fills and crops, contain pads.
- `enlarge` (boolean, default false): Allow making the image larger than it is.
- `print_width` (number, 1–5000): Print width in millimetres. Resizes to this size at dpi; not together with width, height or percent.
- `print_height` (number, 1–5000): Print height in millimetres.
- `dpi` (integer, 72–1200, default 300): Resolution recorded in the file. Without enlarge, an image too small for the print size keeps its pixels and gets the lower resolution that prints it at that size.
- `max_width` (integer, 1–100000): Shorthand: fit inside this width, never enlarge.
- `max_height` (integer, 1–100000): Shorthand: fit inside this height, never enlarge.
- `brightness` (integer, -100–100, default 0): Brightness.
- `contrast` (integer, -100–100, default 0): Contrast.
- `saturation` (integer, -100–100, default 0): Saturation.
- `exposure` (integer, -100–100, default 0): Exposure; two stops at either end.
- `grayscale` (boolean, default false): Black and white.
- `blur` (integer, 0–100, default 0): Blur, relative to the image size.
- `enhance` (boolean, default false): Stretch levels and lift local contrast.
- `sharpen` (integer, 0–100, default 0): Sharpen.
- `denoise` (integer, 0–100, default 0): Noise reduction (median filter).
- `pixelate` (integer, 0–100, default 0): Square blocks, up to a tenth of the longer side. Not applied to animations.
- `motion_blur` (integer, 0–100, default 0): A horizontal streak, up to a twentieth of the longer side. Not applied to animations.
- `posterize` (integer, 0–100, default 0): Fewer tones per colour channel, from 16 down to 2. Not applied to animations.
- `border` (integer, 0–2000, default 0): Border width in pixels, on every side.
- `border_color` (string, default #ffffff): A #rrggbb colour, or transparent.
- `radius` (integer, 0–50, default 0): Rounded corners: the radius as a percentage of the shorter side, cut after the border. The corners are transparent, so format=auto writes PNG for a JPEG.
- `watermark_text` (string): Text to draw on the image.
- `watermark_color` (string, default #ffffff): Colour of the watermark text.
- `watermark_opacity` (integer, 1–100, default 50): Watermark opacity.
- `watermark_size` (integer, 5–100, default 30): Watermark width as a percentage of the image's width.
- `watermark_position` (tl | tc | tr | cl | c | cr | bl | bc | br | tile, default br): A corner, an edge, the centre, or tile.
- `metadata` (strip | keep | no_gps | color, default strip): What to keep of the source's metadata.
- `background` (string, default #ffffff): Painted behind transparent pixels when the output is JPEG.
- `fingerprint` (boolean, default false): Add X-IC-Fingerprint, a perceptual hash of the source.
- `score` (boolean, default false): Add X-IC-Similarity, how close the result is to the source.
- `deliver_to` (string): A pre-signed upload URL of your own storage: the result is PUT there instead of returned, and nothing is stored here.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/inspect

Facts about an image: format, size, metadata, GPS position, fingerprints.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).

### POST /api/v1/remove-background

Cut the subject out of a photo.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `background` (string, default transparent): transparent, a #rrggbb colour, gradient, blur, or image (Pro; multipart part background_image).
- `gradient_from` (string): Top colour for background=gradient.
- `gradient_to` (string): Bottom colour for background=gradient.
- `blur` (integer, 1–100, default 40): Strength for background=blur.
- `feather` (integer, 0–3, default 1): Softness of the cut-out's edge.
- `refine` (boolean, default false): Pull the mask onto the photo's own edges (hair, fur).
- `graphic` (boolean, default false): The picture is a logo or text on a surface: rebuilds the mask from its colours, so the gaps inside and between letters are cut out too. Takes the place of refine. Not for photos.
- `shadow` (boolean, default false): A soft drop shadow under the subject, cast down and to the right.
- `shadow_opacity` (integer, 10–100, default 45): How dark the shadow gets, in percent.
- `frame` (string): Centre the subject on a canvas of this size.
- `subject_fill` (integer, 10–100, default 85): Share of the frame the subject takes up.
- `format` (png | webp | jpeg, default png): jpeg needs a background that is not transparent.
- `mask` (boolean, default false): Return the mask itself, a greyscale PNG of at most 1024 pixels (white is the subject), instead of the cut-out. A corrected mask is sent back as a multipart part named mask, next to image; it is then used in place of the model's.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/upscale

Double an image's width and height with a super-resolution model.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `scale` (2 | 4, default 2): 4 runs the model twice: Pro only, images of up to one megapixel, slower.
- `format` (auto | jpeg | png | webp | avif | gif | tiff, default auto): Output format.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/sprite

Pack 2 to 50 icons into one sprite sheet, with CSS and a JSON map.

Send multipart/form-data with the pictures as image, image2 … image50. Each keeps its size (pictures over 1024 pixels are made smaller) and is packed in rows, tallest first, with gap pixels between. The ZIP holds sprite.png (transparent), sprite.css (a .prefix class with the sheet and a .prefix-name class per picture, named from its file name) and sprite.json (each frame's x, y, width and height). At most 8192 pixels on a side.

- `gap` (integer, 0–32, default 2): Pixels between pictures.
- `prefix` (string, default icon): CSS class prefix.

### POST /api/v1/placeholder

Placeholders to show while a picture loads: LQIP, BlurHash and average colour.

lqip is a 24-pixel-wide blurred WebP as a data URI (a few hundred bytes); blurhash is the BlurHash string of a 64-pixel copy with components_x by components_y components; colour is the average colour as #rrggbb; width and height are the picture's own, for the img's attributes. Nothing is stored.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `components_x` (integer, 1–9, default 4): BlurHash components across.
- `components_y` (integer, 1–9, default 3): BlurHash components down.

### POST /api/v1/responsive-images

One picture at every srcset width and format, with the HTML, as a ZIP.

Makes name-WIDTH.ext for each width (never wider than the picture; its own width is added when it is narrower than the largest asked) in each format, and name.html with a picture element: a source per modern format, the last format as the img with srcset, sizes, width, height, loading=lazy and decoding=async. A see-through picture's jpeg fallback becomes png. X-IC-Widths gives the widths made.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `widths` (string): Up to 10 widths from 16 to 6000, separated by commas.
- `formats` (string): Some of avif, webp, jpeg; the last is the fallback.
- `name` (string): File-name stem; default the upload's name.
- `path` (string, default /images): Where the files will live, for the HTML.
- `sizes` (string, default 100vw): The sizes attribute.
- `alt` (string): The img's alt text.
- `quality` (integer, 1–100, default 80): WebP and JPEG quality; AVIF uses 20 less.

### POST /api/v1/app-icons

Every iOS and Android app icon from one picture, as a ZIP.

ios/AppIcon.appiconset holds the single 1024 x 1024 icon and the Contents.json Xcode 14 and later read; android/mipmap-mdpi … mipmap-xxxhdpi hold ic_launcher.png (48 to 192 px) and ic_launcher_round.png; android/play-store-512.png is the store listing icon. Every square icon is opaque on background, as iOS requires; the picture is centred with padding % on each side, never cropped. The warning source_small means the picture is under 1024 pixels.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `background` (string, default #ffffff): Behind the picture.
- `padding` (integer, 0–40, default 10): Space round the picture, as a percentage of each side.

### POST /api/v1/stitch

Combine 2 to 10 pictures into one, stacked or side by side.

Send multipart/form-data with the pictures as the parts image, image2 … image10, in that order. Each is scaled to a common width (vertical) or height (horizontal), so none is cropped; side is that width or height, by default the smallest picture's. gap puts space between them in background. The result goes through the same encoder as /compress (default PNG, lossless); at most 40 million pixels and 30,000 on the longer side.

- `direction` (vertical | horizontal, default vertical): vertical stacks them (a long screenshot); horizontal puts them side by side.
- `side` (integer, 16–6000): The common width or height.
- `gap` (integer, 0–200, default 0): Pixels between the pictures.
- `background` (string, default #ffffff): Colour of the gaps and behind transparency.
- `format` (png | jpeg | webp, default png): Output format.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/palette

The main colours of a picture, with their shares.

k-means in OKLab on a copy at most 96 pixels on its longer side, seeded the same way every time, so the same picture gives the same palette. colours is a list of { hex, rgb, share }, most common first. Nothing is stored.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `count` (integer, 2–12, default 6): How many colours.

### POST /api/v1/split

Split an image into a grid of equal pieces, as a ZIP.

Cuts the picture into rows x cols pieces (1 to 10 each) and returns a ZIP. With square=true the largest centred area whose pieces are all square is used, for a grid feed. Each file is named post-NN-rowR-colC: NN counts from the bottom-right piece, the order a grid feed needs. X-IC-Files gives the number of pieces.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `rows` (integer, 1–10, default 3): Rows.
- `cols` (integer, 1–10, default 3): Columns.
- `square` (boolean, default false): Trim the edges so every piece is square.
- `format` (jpeg | png | webp, default jpeg): Format of the pieces.
- `quality` (integer, 1–100, default 90): JPEG and WebP quality.

### POST /api/v1/scan-document

Turn a photo of a page into a straight, even scan.

Finds the sheet (the largest bright region; its corners along the four diagonals), or uses the corners given, straightens it in perspective, divides away the light across it, and applies the look. X-IC-Corners (or corners in the JSON) gives the corners used, in the picture as displayed; the warning no_page_found means the whole photo was used. pdf is one A4 page.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `corners` (string): x,y of the top-left, top-right, bottom-right and bottom-left corners. Default: found.
- `look` (colour | grey | bw, default colour): colour evens the light; grey drops colour; bw is black text on white.
- `format` (jpeg | png | pdf, default jpeg): Output format.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/signature

Make a signature image from drawn strokes or typed text.

Send JSON: {"mode": "draw", "strokes": [[[x, y], …], …], "pen": 5, "ink": "#000000"} with points on a 900 x 300 pad (at most 200 strokes and 20,000 points), or {"mode": "type", "text": "Ana Novak", "style": "chancery", "ink": "#1f3a93"} (styles chancery, palatino, bookman, century; at most 60 characters). Without a size the answer is a PNG trimmed to the ink on a transparent ground. With a size (the parameters of /api/v1/id-photo: preset, or width and height, or width_mm and height_mm, dpi, format, min_bytes, max_bytes) the signature is fitted inside it on white and brought inside the size range.

- `width` (integer, 16–6000): Form size width in pixels, with height.
- `height` (integer, 16–6000): Form size height in pixels.
- `format` (jpeg | png, default jpeg): With a size: the format.
- `max_bytes` (integer, 1000–50000000): With a size: the largest the file may be.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/photo-check

Check a photo against an ID photo size's rules, or your own.

Measures the photo (pixels, bytes, format, recorded DPI, number of faces, and the background above and beside the head: its average colour, tone white, light or dark, and how plain it is) and judges it against a preset from GET /api/v1/id-photo or the rules given. checks lists each rule asked for with ok true or false; passed is true when all are met. Runs the face model: an AI request. It does not judge expression, lighting on the face or head position.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `preset` (string): A size from GET /api/v1/id-photo; its rules are used and the parameters below are ignored.
- `width` (integer, 1–100000): Required width in pixels, with height.
- `height` (integer, 1–100000): Required height in pixels.
- `min_bytes` (integer, 1–1000000000): Smallest allowed file size.
- `max_bytes` (integer, 1–1000000000): Largest allowed file size.
- `format` (jpeg | png, default jpeg): Required format.
- `dpi` (integer, 1–10000): Required recorded resolution.
- `background` (string): any (plain), or a rule such as white, light, whiteOrLight, lightGrey, lightNotWhite.
- `one_face` (boolean, default false): Exactly one face.

### POST /api/v1/pdf-shrink

Make a scanned PDF fit a size limit, such as 200 KB for a form.

Send the PDF as the body (or { url }). Each page is drawn as a picture, then resolution (200 down to 50 dpi) and JPEG quality are lowered together until the rebuilt PDF is at most target_bytes; the pages keep their paper size. The result has no text layer: it is for scans. A PDF already under the target is returned unchanged with the warning already_under_target. X-IC-Outcome is unreachable when even 50 dpi at the lowest quality is larger. X-IC-Pages, X-IC-Dpi and X-IC-Quality (or pages, dpi and quality in the JSON) say what was used. Free: up to 20 pages; Pro: 100.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `target_bytes` (integer, 10000–50000000): Required. The largest the PDF may be, in bytes.
- `grayscale` (boolean, default false): Make the pages grey: smaller, and usual for scanned documents.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/collage

Lay two to nine pictures out as one collage.

Send multipart/form-data with the pictures as the file parts image, image2 … image9 (they are placed in that order, in any format the API reads). layout is grid, row, column, hero-left (the first picture large on the left) or hero-top. width and height are the collage's size in pixels (200 to 6000, at most 30 million pixels); gap is the space between and around the pictures, radius rounds their corners, background paints the canvas and the bars around a picture shown with fit=contain. The finished canvas goes through the same encoder as /compress, so format (default JPEG), quality, target_bytes and the other compress options apply, but not its own width and height. The X-IC-Collage-Pictures header (or pictures in the JSON) says how many were placed.

- `layout` (grid | row | column | hero-left | hero-top, default grid): How the cells are laid out.
- `width` (integer, 200–6000, default 2000): Width of the collage in pixels.
- `height` (integer, 200–6000, default 2000): Height of the collage in pixels.
- `gap` (integer, 0–200, default 20): Pixels between the pictures and around them.
- `radius` (integer, 0–500, default 0): Corner radius of each picture, in pixels.
- `fit` (cover | contain, default cover): cover fills each cell and trims the picture; contain shows all of it.
- `background` (string, default #ffffff): Colour of the canvas.
- `format` (jpeg | png | webp | avif | gif | tiff | bmp | ico | jxl | pdf | tga | psd, default jpeg): Output format.
- `quality` (integer, 1–100, default 75): Used by mode quality, for JPEG and WebP.
- `target_bytes` (integer, 1–1000000000): Compress to at most this many bytes.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### GET /api/v1/social-card

The hundred social card templates and the card sizes.

### POST /api/v1/social-card

Make a social card from one of the hundred templates (Pro).

Send JSON {template, title, subtitle, badge, logo, size}. size is og (1200 × 630, the default), twitter, linkedin, square, portrait or story. logo is an inline data:image/png, jpeg, webp or svg+xml;base64 address of at most 600 KB. The card is drawn like /html-to-image, so format (default PNG), quality, target_bytes and the other compress options apply, and scale is 1 or 2. Needs a Pro plan: otherwise upgrade_required. The free colour themes are made with /html-to-image.

- `scale` (1 | 2, default 1): Pixels per card pixel.
- `format` (jpeg | png | webp | avif | gif | tiff | bmp | ico | jxl | pdf | tga | psd, default png): Output format.
- `quality` (integer, 1–100, default 75): Used by mode quality, for JPEG and WebP.
- `target_bytes` (integer, 1–1000000000): Compress to at most this many bytes.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/html-to-image

Draw a page of HTML and CSS as a PNG, JPEG or WebP picture.

The page is drawn by Chromium inside a locked container with no script and no network access: its own CSS, SVG and data: pictures and fonts work, anything fetched from an address does not. Send the HTML as the body (text/html) or as JSON {"html": "…"}, up to 2 MB. width and height are the page's size in CSS pixels; scale multiplies the pixels. The result goes through the same encoder as /compress, so format, quality, mode, target_bytes and the other compress options apply (but not its own width and height, which here mean the page). Default format is PNG, lossless. X-IC-Page-Notes is page_clipped when the page was taller than we draw, and height_unmeasured when full_page could not measure it.

- `width` (integer, 100–4000, default 1280): Width of the page in CSS pixels.
- `height` (integer, 100–4000, default 720): Height of the picture in CSS pixels; the smallest height when full_page is true.
- `scale` (1 | 2 | 3, default 1): Pixels per CSS pixel. The picture may not exceed 40 million pixels.
- `full_page` (boolean, default false): Draw the whole page, up to 16,000 CSS pixels tall.
- `transparent` (boolean, default false): Leave the page's background see-through where it sets none. PNG and WebP only.
- `format` (jpeg | png | webp | avif | gif | tiff | bmp | ico | jxl | pdf | tga | psd, default png): Output format.
- `mode` (quality | smart | lossless | target, default quality): PNG defaults to lossless when neither mode nor target_bytes is given.
- `quality` (integer, 1–100, default 75): Used by mode quality, for JPEG and WebP.
- `target_bytes` (integer, 1–1000000000): Compress to at most this many bytes.
- `background` (string, default #ffffff): Painted behind transparent pixels when the output is JPEG.
- `metadata` (strip | keep | no_gps | color, default strip): What to keep of the picture's metadata.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/screenshot

Take a picture of the web page at a public address.

Chromium draws the page at the address. It runs in a locked container whose only way out is a proxy that reaches public addresses on ports 80 and 443; an address on a private network, or one that resolves to one, is refused (fetch_failed). The page's own script does not run, so what the server sends is what is drawn. Sizes, formats and the compress options work as for /html-to-image. X-IC-Page-Notes is page_clipped when the page was taller than we draw, and slow_page when it had not finished loading after 25 seconds and was drawn as it was.

- `url` (string): The page's address, http:// or https://. May also be sent as JSON {"url": "…"}.
- `width` (integer, 100–4000, default 1280): Window width in CSS pixels.
- `height` (integer, 100–4000, default 720): Window height in CSS pixels; the smallest height when full_page is true.
- `scale` (1 | 2 | 3, default 1): Pixels per CSS pixel. The picture may not exceed 40 million pixels.
- `full_page` (boolean, default false): Draw the whole page, up to 16,000 CSS pixels tall.
- `transparent` (boolean, default false): Leave areas the page does not paint see-through. PNG and WebP only.
- `format` (jpeg | png | webp | avif | gif | tiff | bmp | ico | jxl | pdf | tga | psd, default png): Output format.
- `mode` (quality | smart | lossless | target, default quality): PNG defaults to lossless when neither mode nor target_bytes is given.
- `quality` (integer, 1–100, default 75): Used by mode quality, for JPEG and WebP.
- `target_bytes` (integer, 1–1000000000): Compress to at most this many bytes.
- `background` (string, default #ffffff): Painted behind transparent pixels when the output is JPEG.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/favicon

Make a favicon pack: every icon size a site needs, the web manifest and the HTML.

Returns a ZIP with favicon.ico (16, 32 and 48 pixels), PNG icons of 16, 32, 48, 180 (Apple), 192 and 512 pixels, a maskable 512-pixel icon, site.webmanifest and favicon.html with the lines for the page's head. A picture that is not square is centred, never cropped. X-IC-Warnings is source_small when the picture is under 512 pixels.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `name` (string, default My site): The site's name, for the web manifest.
- `short_name` (string): A shorter name for a phone's home screen. Default: the name.
- `theme_color` (string, default #ffffff): The browser's toolbar colour on phones.
- `background` (string, default #ffffff): Behind the picture on the Apple and maskable icons, which may not be see-through.
- `padding` (integer, 0–40, default 0): Percent of the icon's side kept clear around the picture.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/gif

Crop, trim, speed up, slow down, reverse, thin or resize an animated GIF.

Order: trim, keep every Nth frame, reverse, speed, crop, resize, encode. Frames are composed first, so every frame handled is a whole picture. Also reads animated WebP. X-IC-Frames and X-IC-Animation-Ms describe the result; X-IC-Source-Frames and X-IC-Source-Animation-Ms the upload.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `crop` (string): x,y,width,height in the animation's pixels, applied to every frame.
- `width` (integer, 1–10000): Resize to this width, keeping the shape. Never enlarges.
- `trim_start` (number): Seconds from the start to cut away.
- `trim_end` (number): Seconds from the start where the animation ends.
- `speed` (integer, 25–400, default 100): Percent: 200 plays twice as fast. No frame is shown for less than 20 ms.
- `reverse` (boolean, default false): Play backwards.
- `every` (integer, 1–4, default 1): Keep every Nth frame; the time of the dropped frames goes to the one kept.
- `colours` (integer, 2–256, default 256): Palette size, for GIF output.
- `loop` (integer, 0–65535): Times the animation repeats; 0 for ever. Default: as the upload.
- `format` (gif | webp, default gif): webp writes an animated WebP, usually far smaller.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### GET /api/v1/id-photo

The ID photo sizes the preset parameter accepts.

Country presets carry the official page they were read from and the day it was read.

### POST /api/v1/id-photo

Make an ID or passport photo: exact size, resolution, file-size range, print sheet.

Crops to the photo's shape, resizes to its exact pixel size, records the resolution, and brings the file inside the size range by quality alone: the pixel size never changes. X-IC-Outcome is unreachable when the file cannot be made that small. We size the file; we do not check face position, expression or lighting.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `preset` (string): A size from GET /api/v1/id-photo. The parameters below override it.
- `width_mm` (number, 5–300): Photo width in millimetres, with height_mm.
- `height_mm` (number, 5–300): Photo height in millimetres.
- `width` (integer, 16–6000): Photo width in pixels, with height. Not together with the millimetres.
- `height` (integer, 16–6000): Photo height in pixels.
- `dpi` (integer, 72–1200, default 300): Resolution: turns millimetres into pixels and is recorded in the file.
- `crop` (string): x,y,width,height in the picture as displayed. Default: the largest centred crop of the photo's shape.
- `format` (jpeg | png, default jpeg): Output format.
- `min_bytes` (integer, 1000–50000000): The file is padded up to this size when it is smaller.
- `max_bytes` (integer, 1000–50000000): The file is compressed to at most this size.
- `background` (string, default #ffffff): Painted behind transparent pixels, and behind the person with remove_background.
- `remove_background` (boolean, default false): Cut the person out and put them on the background colour. Counts as an AI request.
- `sheet` (boolean, default false): Return a 4 x 6 inch (10 x 15 cm) sheet of copies with 2 mm gaps instead of the single photo.
- `clean_ink` (boolean, default false): A signature: make the paper white and the ink solid, crop tight around the ink, and fit it inside the size without cutting any off. The default crop is the whole picture. Not with remove_background.
- `ink` (black | original, default black): With clean_ink: black ink, or the pen's own colour, slightly deepened.
- `caption_name` (string): A name written in a white strip at the bottom, inside the size; the portrait is cropped to the part above it.
- `caption_date` (string): A date, as you want it shown, on the strip's second line.
- `caption_percent` (integer, 10–40, default 18): The caption strip's share of the height, in percent, for a form that fixes it.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/faces

Find the faces in a picture.

Boxes are in the picture as displayed (after EXIF orientation), largest first. Detection can miss faces that are small, turned away or covered. Nothing is stored.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).

### POST /api/v1/blur-faces

Blur or pixelate the faces in a picture.

Covers an ellipse a little larger than each box. Without boxes, every face the detector finds is covered, and the request counts as an AI request; with boxes, only those areas are covered and no model runs. X-IC-Faces says how many areas were covered. Check the result: detection can miss faces.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `effect` (blur | pixelate | fill, default blur): How the areas are hidden. fill paints a solid box in color: the only one that cannot be read back, so use it for text and numbers.
- `shape` (ellipse | rect, default ellipse): ellipse: grown 15% around each box, for faces. rect: exactly each box, for redacting.
- `color` (string, default #000000): The colour of a fill.
- `strength` (integer, 1–100, default 60): Blur radius or pixel block size, relative to each face.
- `boxes` (string): The areas to cover as x,y,width,height, separated by ;. An empty value covers nothing.
- `format` (auto | jpeg | png | webp | avif | tiff, default auto): auto keeps the input's format where it is one of these, else JPEG. Quality 92.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### POST /api/v1/ocr

Read the text in an image.

- `filename` (string): The file's name. Only its extension is used: formats without a signature of their own (TGA, some camera RAW files, old computer formats) are told apart by it. Not needed with multipart, which carries the name, or with a url.
- `page` (integer, 1–100000, default 1): Which page, frame or plane of a file that holds several (PDF, DjVu, DICOM, a scan volume).
- `lang` (string, default eng): One or more of eng, slv, comma-separated.

### POST /api/v1/pipeline

Run several steps on one image (Pro plan).

- `pipeline` (string): The pipeline as JSON. May also be a multipart field or part of a JSON body.
- `preset` (string): A saved pipeline's name, or a template's.
- `version` (integer, 1–1000000): A version of a saved pipeline. Default: the latest.
- `dry_run` (boolean, default false): Report what would run, and the predicted sizes, without processing.
- `name` (string): The source file's name, for the output name pattern.
- `output` (binary | json, default binary): binary returns the image; json stores it for an hour and returns a link.

### GET /api/v1/pipelines

Saved pipelines and the built-in templates.

### POST /api/v1/pipelines

Save a pipeline under a name; an existing name gets a new version.

### GET /api/v1/pipelines/{name}

One saved pipeline.

- `name` [path] (string): The pipeline's name.
- `version` (integer, 1–1000000): Default: the latest.

### DELETE /api/v1/pipelines/{name}

Delete every version of a saved pipeline.

- `name` [path] (string): The pipeline's name.

### GET /api/v1/jobs

The caller's jobs of the last hour, newest first.

### POST /api/v1/jobs

Run a pipeline over several images in the background (Pro plan).

Also reachable as /api/v1/batch. Images come as inputs (addresses) or as multipart file parts image, image_1 … image_19.

- `Idempotency-Key` [header] (string): Repeat the request safely: the same key returns the original job.

### POST /api/v1/batch

The same as POST /api/v1/jobs.

### GET /api/v1/jobs/{id}

A job's status, progress and results.

- `id` [path] (string): The id returned when it was created.

### DELETE /api/v1/jobs/{id}

Cancel a job; finished images keep their results.

- `id` [path] (string): The id returned when it was created.

### POST /api/v1/sites/optimize

Scan a website and convert its images to WebP.

### GET /api/v1/sites/optimize/{id}

A scan's status and, when done, its report.

- `id` [path] (string): The id returned when it was created.

### GET /api/v1/sites/tiers

What each Website Optimizer tier covers, and the caller's plan, the websites it holds and its scan packages with the pages they have left (credits[].pages_left; scan_pages is what the next scan can take).

### GET /api/v1/sites/schedules

The account's scheduled re-scans.

### PUT /api/v1/sites/schedules

Scan a website again by itself, weekly or monthly (Pro), or stop doing so.

The website must have been scanned once, from its address or its sitemap (a list of addresses is not kept). Each run is an ordinary scan of the same project, started with the settings of the latest scan, without a review step, as the account at that time: when the account is no longer Pro the schedule pauses (paused: not_pro) and starts again when you set it again. Three runs that cannot start in a row pause it too (paused: failing). A run that finds the account's scans busy is tried again an hour later. frequency off removes the schedule, on any plan.

### GET /api/v1/sites/scans

The account's website projects with their scans.

### POST /api/v1/sites/scans

Start a scan of a website from an address, a sitemap or a list of addresses.

### GET /api/v1/sites/scans/{id}

A scan's status, progress, totals and downloads.

- `id` [path] (string): The id returned when it was created.

### PATCH /api/v1/sites/scans/{id}

Select pages, start, cancel, retry, optimize or package a scan.

- `id` [path] (string): The id returned when it was created.

### DELETE /api/v1/sites/scans/{id}

Delete a scan, its results and its files.

- `id` [path] (string): The id returned when it was created.

### GET /api/v1/sites/scans/{id}/pages

The page inventory of a scan.

- `id` [path] (string): The id returned when it was created.
- `status` (string): See the Website Optimizer section of the developer page.
- `over_limit` (string): See the Website Optimizer section of the developer page.
- `q` (string): See the Website Optimizer section of the developer page.
- `attention` (string): See the Website Optimizer section of the developer page.
- `optimization` (string): See the Website Optimizer section of the developer page.
- `min_savings` (string): See the Website Optimizer section of the developer page.
- `sort` (string): See the Website Optimizer section of the developer page.
- `offset` (string): See the Website Optimizer section of the developer page.
- `limit` (string): See the Website Optimizer section of the developer page.

### GET /api/v1/sites/scans/{id}/pages/{seq}

One page with every asset it uses.

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.

### GET /api/v1/sites/scans/{id}/assets

The asset inventory of a scan.

- `id` [path] (string): The id returned when it was created.
- `kind` (string): See the Website Optimizer section of the developer page.
- `status` (string): See the Website Optimizer section of the developer page.
- `issue` (string): See the Website Optimizer section of the developer page.
- `page` (string): See the Website Optimizer section of the developer page.
- `q` (string): See the Website Optimizer section of the developer page.
- `min_savings` (string): See the Website Optimizer section of the developer page.
- `mapped` (string): See the Website Optimizer section of the developer page.
- `sort` (string): See the Website Optimizer section of the developer page.
- `offset` (string): See the Website Optimizer section of the developer page.
- `limit` (string): See the Website Optimizer section of the developer page.

### GET /api/v1/sites/scans/{id}/assets/{seq}

One asset, the pages that use it and its line of the replacement map.

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.

### PATCH /api/v1/sites/scans/{id}/assets/{seq}

Approve or reject an asset's replacement.

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.

### GET /api/v1/sites/scans/{id}/assets/{seq}/file

An asset's optimized file, a variant, a replacement candidate, or the original passed through.

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.
- `original` (string): See the Website Optimizer section of the developer page.
- `candidate` (string): See the Website Optimizer section of the developer page.
- `variant` (string): See the Website Optimizer section of the developer page.
- `download` (string): See the Website Optimizer section of the developer page.

### POST /api/v1/sites/scans/{id}/assets/{seq}/replacement

Propose another picture for an image: upload one, or ask for one to be generated (not available yet).

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.
- `brief` (string): See the Website Optimizer section of the developer page.

### DELETE /api/v1/sites/scans/{id}/assets/{seq}/replacement

Drop an image's replacement candidate.

- `id` [path] (string): The id returned when it was created.
- `seq` [path] (integer): The page's or asset's number within its scan.

### GET /api/v1/sites/scans/{id}/exports

A replacement map (CSV, JSON, XLSX), a report or an agent prompt; without `file`, the list.

- `id` [path] (string): The id returned when it was created.
- `file` (string): See the Website Optimizer section of the developer page.

### GET /api/v1/sites/scans/{id}/download

The whole package as a ZIP (in parts when very large).

- `id` [path] (string): The id returned when it was created.
- `part` (string): See the Website Optimizer section of the developer page.

### GET /api/v1/sites/scans/{id}/log

What a scan did and what went wrong.

- `id` [path] (string): The id returned when it was created.

### GET /api/v1/files/{id}

Download a stored result.

- `id` [path] (string): The id returned when it was created.

### DELETE /api/v1/files/{id}

Delete a stored result before it expires.

- `id` [path] (string): The id returned when it was created.

### GET /api/v1/assets

Search the asset index.

The index holds facts about your images across projects (fingerprints, sizes, paths), never the images themselves.

- `q` (string): Text to find in the path, project or format.
- `project` (string): Only this project.
- `limit` (integer, 1–500, default 100): How many to return.

### POST /api/v1/assets

Replace one project's entries with a fresh scan.

### DELETE /api/v1/assets

Remove a project from the index.

- `project` (string): The project to remove.

### GET /api/v1/assets/duplicates

Identical files that appear more than once across your projects.

### GET /api/v1/formats

The formats this server reads and writes.

### GET /api/v1/capabilities

Operations, options and limits of this server.

### GET /api/v1/usage

This month's usage and your limits.

### GET /api/v1/openapi.json

This document.

## Limits

- Free: 1,000 requests and 100 AI requests a month, 120 a minute, files up to 20 MB.
- Pro: 20,000 requests and 2,000 AI requests a month, 600 a minute, files up to 200 MB.
- One request is one credit, whatever options it uses. The website optimizer counts one request per image it converts.
- Background removal, upscaling and image to text are AI requests and count against the AI allowance, not the ordinary one. A pipeline that runs a model counts as one request of each kind. X-Quota-Meter says which allowance a response was counted against.
- Test keys (ic_test_…) are for building and CI: they never use your quota, take files of up to 1 MB and allow 50 requests a day. Their responses carry X-IC-Test-Mode: true.
- A live key can have a monthly limit of its own, set when you create it, so that one integration cannot use up the whole account's quota.
- We email the account owner once when 80% of a monthly quota is used and once when it is used up.
- We never store what you upload. Results you ask for as a link are deleted after one hour.

## Errors

Errors are JSON with a code and a message. 429 and 503 responses carry a Retry-After header.

```json
{ "error": { "code": "file_too_large", "message": "…" } }
```

## Pipelines and jobs

A pipeline runs several steps on one image in one request: remove the background, resize, convert, compress. Steps can carry conditions, a dry run shows what would happen, and a job runs a pipeline over many images in the background. Pipelines and jobs need a Pro plan; a free account gets upgrade_required (403).

```bash
curl -X POST "https://imagecompressor.si/api/v1/jobs" \
  -H "Authorization: Bearer $IMAGECOMPRESSOR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{
    "inputs": [{ "url": "https://example.com/a.jpg" }, { "url": "https://example.com/b.png" }],
    "pipeline": { "steps": [
      { "op": "resize", "when": { "min_width": 2561 }, "params": { "width": 2560 } },
      { "op": "compress", "params": { "format": "webp", "mode": "smart" } }
    ] },
    "webhook_url": "https://example.com/hooks/images"
  }'
```

## Webhooks

Give a job a webhook_url and we POST the finished job there, signed with your account's secret (Standard Webhooks). A failed delivery is retried after 5 seconds, 30 seconds and 2 minutes. Verify the signature before trusting the body.

```js
import { verifyWebhook } from "@imagecompressor/sdk";

// body: the raw request body, exactly as received
const event = await verifyWebhook(process.env.IMAGECOMPRESSOR_WEBHOOK_SECRET, body, request.headers);
if (event.type === "job.finished") {
  for (const result of event.data.results) console.log(result.status, result.url);
}
```

## MCP server

Connect your AI coding agent and ask it to optimize the images in your project or on your site. Its tools compress, convert, resize and crop images, remove backgrounds, upscale, read text, find and blur faces, turn HTML or a web page into an image, and optimize a whole website.

Endpoint (Streamable HTTP): https://imagecompressor.si/api/mcp

```json
{
  "mcpServers": {
    "imagecompressor": {
      "type": "http",
      "url": "https://imagecompressor.si/api/mcp",
      "headers": {
        "Authorization": "Bearer ic_live_..."
      }
    }
  }
}
```

No key at hand? Apps that support MCP sign-in (Claude, ChatGPT, Cursor and others) can connect with just the endpoint: add it as a remote MCP server and sign in when the app asks. Connected apps are listed, and can be disconnected, on your account's API keys page.

- `compress_image(image_url, image_base64, format, mode, quality, target_bytes, max_width, max_height, crop_ratio, rotate)`: Make an image file smaller. Keeps the format unless `format` is given. Set `target_bytes` to hit an exact file size (e.g. 100000 for 100 KB). Otherwise `mode` decides: `smart` (default) finds the smallest file that still looks like the original, `quality` uses `quality` (1-100), `lossless` keeps every pixel (PNG, WebP, AVIF, TIFF only), `keep` does not compress: the image comes back as it was with only its metadata removed. Reads JPEG, PNG, WebP, AVIF, GIF, TIFF and SVG. Returns a download URL valid for one hour.
- `convert_image(image_url, image_base64, format, quality, max_width, max_height)`: Convert an image to JPEG, PNG, WebP, AVIF, GIF or TIFF. Use `webp` or `avif` to modernise images for the web. Returns a download URL valid for one hour.
- `remove_background(image_url, image_base64, background, refine, graphic, shadow, format)`: Cut the subject out of a photo. The background becomes transparent (PNG or WebP), a solid colour if `background` is a hex colour like #ffffff, or the original scene blurred if it is `blur`. Set `refine` for hair, fur and other fine edges, or `graphic` for a logo or text on a surface. Returns a download URL valid for one hour.
- `optimize_website(url, quality, max_pages)`: Start at one public web page, follow its links to the other pages on the same host, find every image they reference (img, srcset, picture, lazy-load attributes, inline CSS backgrounds, social images, icons), convert them to WebP and return a report: the pages scanned, each image's size before and after and the pages that use it, a download URL per image, `zip_url` for everything, and `replacements` mapping each original URL to its new file. To apply it to a codebase: download and unpack the ZIP, put the files from images/ next to the originals, then change each reference per `replacements` (or wrap it in a <picture> element with the WebP as <source> and the original as the <img> fallback). The free plan scans up to 5 pages and 100 images per call, Pro up to 50 pages and 500 images. A large site can take minutes: if the result is not ready the call returns a job_id to pass to get_website_report.
- `get_website_report(job_id)`: The result of an optimize_website call that was still working when it returned. Pass its job_id. Waits up to a minute for the scan to finish.
- `list_website_scans()`: The website projects of this account with their scans, newest first: id, site, status, pages analysed, bytes saved. Reads only.
- `get_website_scan(scan_id)`: Where a scan stands, what it found and saved, and the download addresses of its ZIP, replacement maps and reports. In `totals.bytes`, `estimated_savings` is a prediction; `optimized_from` and `optimized_to` are measured. Reads only.
- `list_website_pages(scan_id, status, search, offset, limit)`: Page inventory of a scan: address, status, images, sizes, estimated and measured savings. Paged; filter by status or search. Reads only.
- `list_website_assets(scan_id, kind, status, finding, page, search, offset, limit)`: Asset inventory of a scan: images, style sheets, scripts and fonts with their sizes, findings and state. `estimated_bytes` is a prediction, `optimized_bytes` is measured. Scripts and fonts are analysed only. Paged; filter by kind, status, finding or page. Reads only.
- `get_replacement_mapping(scan_id, offset, limit)`: What replaces what: one entry per original asset with original_url, original_path, replacement_path, package_file, sizes, replacement_status (ready, proposed, keep_original, rejected) and the pages that use it. Paged. Act only on entries that are `ready`; the files themselves are in the scan's ZIP (get_website_scan gives the address). To change a project's files, use the local server's tools (load_replacement_package, preview_replacements, apply_replacements), which ask the person first. Reads only.
- `get_agent_prompt(scan_id, agent)`: The step-by-step instructions for applying this scan's package: inspect the project, match each map entry to real files, change one reference at a time, validate, report what is unresolved. Never a blind search-and-replace. Still answered after the scan's files have been deleted. Reads only.
- `run_pipeline(image_url, image_base64, pipeline, preset, version, dry_run, name)`: Run a multi-step workflow on an image in one call, for example remove the background, resize, convert and compress. Needs a Pro plan. Give "pipeline": { "steps": [{ "op", "params", "when"? }] } with ops remove_background, upscale, resize, crop, rotate, edit, watermark, convert, compress (params are the REST API's options, e.g. { "width": 1600 } or { "format": "webp", "mode": "smart" }; "when" makes a step conditional on format, min_width, max_width, min_bytes, max_bytes or has_alpha), or "preset": the name of a saved pipeline or a template (web-optimized, thumbnail, product-square, social-square, avatar, private-share). Set dry_run to see which steps would run and the resulting size without processing anything. Returns a download URL valid for one hour and a report of every step.
- `inspect_image(image_url, image_base64)`: Facts about an image without changing it: format, dimensions, file size, colour space, transparency, which hidden metadata it carries (EXIF, GPS position, colour profile), camera details, and fingerprints for finding duplicates.
- `html_to_image(html, width, height, scale, full_page, transparent, format, quality)`: Draw a page of HTML and CSS as a PNG, JPEG or WebP picture: social cards, badges, receipts, mockups, diagrams in SVG. The page is drawn by Chromium with no script and no network access, so inline CSS, SVG and data: pictures and fonts work and anything fetched from an address does not. `width` and `height` are the page's size in CSS pixels; `scale` 2 makes a sharper picture; `full_page` draws a long page to its end. Returns a download URL valid for one hour.
- `screenshot_url(url, width, height, scale, full_page, format, quality)`: Take a picture of the web page at a public http(s) address: PNG, JPEG or WebP, the first screen or the whole page. The page is drawn by Chromium without running its own script (what the server sends is what is drawn), and only public addresses can be reached. `scale` 2 makes a sharper picture. Returns a download URL valid for one hour.
- `upscale_image(image_url, image_base64, scale, format)`: Double an image's width and height with a super-resolution model, which reconstructs edges and texture instead of blurring. Takes images of up to about one megapixel (2.25 on Pro). `scale` 4 (Pro, up to one megapixel, slower) runs the model twice. Returns a download URL valid for one hour.
- `extract_text(image_url, image_base64, languages)`: Read printed text from a scan, a screenshot or a photo of a page. Languages: eng (English) and slv (Slovenian). Returns the text and the engine's confidence; below about 60 the text needs checking.
- `get_usage()`: How many requests this account has used this month, and its limits.
