Images

Compress an image again

Runs the stored original through again with new settings and answers with a new image; the one you started from stays as it is. Nothing is uploaded again, but it counts as a compression like an upload does. It is how you try ultra after smart, or AVIF after WebP. Any image that isn't still running can go again, a failed or cancelled one included. A resize that would take the image past 64 megapixels is refused with the message under errors.image.

post/images/{id}/recompress

Request

  • Base URL: https://www.iminify.com/api/v1
  • URL: https://www.iminify.com/api/v1/images/{id}/recompress
  • Auth: HTTP bearer

Path parameters

idstring uuid required

The image's id.

Request body

level'none' | 'lossless' | 'ultra' | 'smart'
format'auto' | 'webp' | 'avif' | 'png' | 'jpg'
keep_metadataboolean

Keep the EXIF metadata (camera, date, location) in the optimized copy. Off by default, which strips it; the orientation is applied to the pixels first, so a photo never comes back on its side.

widthinteger nullable

Resize to this width in pixels. Alone, the height follows the aspect ratio. With height too, the image is resized to exactly that size, and its proportions change if they differ. Up to 65535.

heightinteger nullable

Resize to this height in pixels, the same way as width. Up to 65535.

scaleinteger nullable

Resize to this percentage of the original, 1 to 100. Cannot be combined with width or height.

alt_textboolean

Write an alt text and a suggested file name for the image with AI. On by default; send false to leave it out. A small copy of the image goes to Anthropic, whose Claude model writes both, and they arrive a few seconds after the image finishes. Each one counts against your daily AI alt texts; once those are used up the image still compresses, without one. See Alt text and file names.

alt_text_language'en' | 'es' | 'fr' | 'de' | 'it' | 'pt' | 'nl' | 'pl' | 'sv' | 'tr' | 'ru' | 'uk' | 'ar' | 'fa' | 'he' | 'hi' | 'id' | 'vi' | 'th' | 'ja' | 'ko' | 'zh-Hans' | 'zh-Hant'

The language to write the alt text in, as one of these tags: en (English), es (Spanish), fr (French), de (German), it (Italian), pt (Portuguese), nl (Dutch), pl (Polish), sv (Swedish), tr (Turkish), ru (Russian), uk (Ukrainian), ar (Arabic), fa (Persian), he (Hebrew), hi (Hindi), id (Indonesian), vi (Vietnamese), th (Thai), ja (Japanese), ko (Korean), zh-Hans (Simplified Chinese), zh-Hant (Traditional Chinese). The suggested file name follows it when the language is written in the Latin alphabet, and is in English otherwise.

use_suggested_nameboolean

Rename the optimized copy to the suggested file name as soon as the alt text arrives, unless it already has a new name by then: yours, or an earlier suggestion.

Response

Queued. Location points at the new record.

Changes

No recorded changes to this operation across all 1 revision of this API.