Compress an image

Re-encode an image with quality/format options to reduce file size. Supports jpeg, png, webp, tiff, gif. Instead of a q number you can set quality_target (0-1]: the smallest file with SSIM at or above the target, searched on the worker (jpeg, webp, avif; flat surcharge; outcome reported in X-Pictomancer-Quality-* headers). If the output is not smaller than the input, the request is free (X-Pig-Billed: 0) and does not consume free-tier quota. Optional enhancement modifiers: denoise (1-3), equalize, sharpen (applied denoise -> equalize -> op -> sharpen).

post/v1/compress

Request

  • Base URL: https://api.pictomancer.ai (the document declares no server; this is the origin it was published from)
  • URL: https://api.pictomancer.ai/v1/compress
  • Auth: none declared

Request body

sourcestring required

Image source: a public URL (https://...) or a base64-encoded string (optionally as a data URI like data:image/png;base64,...).

qinteger nullable

Quality (1-100). Lower = smaller file. Typical values: 60-80 for web, 85-95 for print. Maps to libvips Q parameter.

formatstring nullable

Output format: jpeg, png, webp, tiff, gif, or avif. If omitted, the original format is preserved.

stripboolean nullable

Strip metadata (EXIF, ICC profile, etc.) from the output. Reduces file size slightly.

quality_targetnumber nullable

Target SSIM (0-1]: the worker searches for the smallest file that still scores at least this. Alternative to q; mutually exclusive with it. Requires an explicit format among jpeg, webp, avif. Carries a flat surcharge for the extra encodes.

autorotboolean nullable

Apply EXIF orientation before compressing. Opt-in; default false, which preserves current byte-for-byte behavior.

denoiseinteger nullable

Median denoise before compressing: radius 1-3 (window 3x3 to 7x7). Opt-in; no surcharge.

equalizeboolean nullable

Auto-contrast (histogram equalisation of the value channel; hue and saturation preserved) before compressing. Opt-in.

sharpenboolean nullable

Unsharp-mask sharpen after compressing (libvips defaults). Opt-in.

Response

Processed image binary

unknown required

Changes

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