Convert to WebP

Convert a JPEG, PNG, AVIF, WebP, or BMP image to lossy or lossless WebP locally in your browser, or compress it to JPEG, WebP, or AVIF. Three statically linked QIP components cover opaque photos, lossy transparency, and exact lossless pixels; the image is not uploaded.

Encoding

Opaque encoding reserves 448 MiB of Wasm memory. Transparency is composited over the selected background.

Every encoder accepts at most 25,000,000 pixels and 8192 pixels on either side. JPEG, PNG, AVIF, and WebP are first decoded to RGBA8 KTX2, which the KTX2 encoders read directly. BMP goes straight to the BMP encoders: opaque mode accepts 24-bit BI_RGB, 32-bit BI_RGB BGRX, and explicitly masked V5 BGRA, and the alpha-preserving modes require 32-bit pixels. In opaque mode, transparency is flattened over the selected background. Opaque lossy mode is the better default for photographs, while lossless mode is intended for pixels that must round-trip exactly. Resize larger camera originals before encoding.

The worker is discarded after every encode. This releases its fixed Wasm memory instead of keeping a 448 MiB, 1.1875 GiB, or 1.5 GiB instance attached to the page.

Components #

Decoders:

KTX2 encoders:

BMP encoders:

CLI equivalent #

# JPEG to opaque lossy WebP (via KTX2); use png-to-ktx2, avif-to-ktx2,
# or webp-to-ktx2 for other formats
npx @qip.dev/qipx qip.dev run \
  image/jpeg/jpeg-to-ktx2-r8g8b8a8-srgb.wasm \
  image/ktx2/ktx2-r8g8b8a8-or-b8g8r8a8-srgb-to-webp-lossy-opaque.wasm \
  -u quality=95 -u method=4 -u sharp_yuv=1 -u low_memory=1 \
  -u background_color_rgb=0xffffff \
  < input.jpg > output.webp

# PNG to lossy WebP with alpha
npx @qip.dev/qipx qip.dev run \
  image/png/png-to-ktx2-r8g8b8a8-srgb.wasm \
  image/ktx2/ktx2-r8g8b8a8-srgb-to-webp-lossy.wasm \
  -u quality=95 -u method=4 -u sharp_yuv=1 -u low_memory=1 \
  < input.png > output.webp

# PNG to lossless WebP
npx @qip.dev/qipx qip.dev run \
  image/png/png-to-ktx2-r8g8b8a8-srgb.wasm \
  image/ktx2/ktx2-r8g8b8a8-or-b8g8r8a8-srgb-to-webp-lossless.wasm \
  -u level=6 \
  < input.png > output.webp

# BMP to opaque lossy WebP
npx @qip.dev/qipx qip.dev run \
  image/bmp/bmp-b8g8r8a8-srgb-to-webp-lossy-opaque.wasm \
  -u quality=95 -u background_color_rgb=0xffffff \
  < input.bmp > output.webp