image.convert

Re-encode an image to another format at a chosen quality. It's the terminal encoder of a branch — the last thing that runs before the bytes are written out.

Config

FieldTypeDefaultNotes
formatjpg · png · webp · avif · gif · tiffjpgOutput container. The inputs it can read are on Compatible files.
qualitynumber 1–10090The only dial. Applies to jpg, webp, avif, tiff; ignored by png and gif. Out-of-range values are clamped. Per-codec effort is the transport’s choice, not yours to set.
Leave image.convert off a branch and the image passes through in its source format (resize still applies) — the cheapest path when you only need to shrink dimensions.

Choosing a format

  • webp — the default reach-for: broad support, small at quality 75–85.
  • avif — smallest for the same quality, slower to encode. Great for hero images.
  • jpg — universal, photographic.
  • png — lossless, transparency. Reach for webp/avif unless you need lossless.

In a pipeline

{
  id: 'convert',
  type: 'image.convert',
  config: {
    format: { value: 'webp' },
    quality: { value: 82 },
  },
}

With runQueue

tk.runQueue(files, 'image')
  .maxSize(2048)
  .convert({ format: 'avif', quality: 60 });

Convert pairs with image.resize in a single decode/encode pass, so a resize-then-convert branch never touches the pixels twice.