Image output formats Last updated: 07. Jul 2026

Docly can deliver modern image formats (WebP / AVIF) with better compression via scaleImage and the site-wide default format.

Docly can deliver modern image formats with better compression. This applies to scaleImage, attachFile64 and the site-wide default (Images.DefaultFormat in site.json).

Available formats

Format

Value

Encoding

Use

JPEG

jpeg

GDI+ (fastest)

Standard, universal.

PNG

png

GDI+

Lossless / transparency.

WebP

webp

Magick.NET

Better compression than JPEG; universal browser support today.

AVIF

avif

Magick.NET

Best compression; modern browsers. Recommended for the highest performance score (Google's recommendation).

Auto

auto (default)

Preserve the source format (PNG → PNG), otherwise JPEG. Falls back to Images.DefaultFormat if set.

How to choose a format

  • Per call: docly.scaleImage(bytes, 1200, 800, 0, 80, "webp") — an explicit format always wins. quality (here 80) applies to WebP/AVIF too.
  • Site default: set Images.DefaultFormat: "webp" in site.json → every scaleImage call without an explicit format uses WebP.
// explicit AVIF, quality 60
var out = docly.scaleImage(bytes, 800, 600, 0, 60, "avif");

// or a site-wide default in site.json:
{ "Images": { "DefaultFormat": "webp" } }

Important limitation (document precisely): WebP/AVIF apply to scaleImage / attachFile64 (and the site default). The URL-based scaling (/photo.jpg/WxHxM/…) delivers JPEG. If you need WebP/AVIF on a link, generate the image with scaleImage and serve/store it yourself. See Image scaling & allowed sizes.