Tool workspace

Image Converter

Convert common image formats locally in your browser with preview and download.

Files are processed locally in your browser.

Files are processed locally in your browser.

Select a file and conversion mode.

Use in code

Browser image conversion typically uses File/Canvas APIs. Server-side workflows can use dedicated imaging libraries.

Convert image with Canvas API in browser

TypeScript

Primary API

canvas.toBlob(callback, mimeType, quality)

Reads a File input, draws to canvas, and exports to WebP/JPG/PNG.

Built-in APILibrary: Browser File + Canvas APIs
async function convertImage(file: File, format: "image/webp" | "image/jpeg" | "image/png") {
  const bitmap = await createImageBitmap(file);
  const canvas = document.createElement("canvas");
  canvas.width = bitmap.width;
  canvas.height = bitmap.height;
  const ctx = canvas.getContext("2d");
  if (!ctx) throw new Error("Canvas unavailable");
  ctx.drawImage(bitmap, 0, 0);

  const blob = await new Promise<Blob>((resolve, reject) => {
    canvas.toBlob((result) => (result ? resolve(result) : reject(new Error("Encode failed"))), format, 0.85);
  });

  return blob;
}

Reference: Browser File + Canvas APIs documentation

How to use

  1. Choose an image file or drag and drop it.
  2. Select output format and optional resize/quality settings.
  3. Convert and download the generated file.

Use cases

  • Reduce image size for web uploads.
  • Convert between PNG, JPG, and WebP for compatibility.

Limitations and caveats

  • Animated images are exported as a single frame.
  • Very large images may be limited by browser memory.

Related tools