Cluster A: SVG to WebP Conversion

SVG Rasterization Guide: width, height, viewBox & Retina 2x/3x Export

Rasterizing an SVG means sampling continuous vector geometry onto a finite grid of pixels. Understanding three attributes—width, height, and viewBox—prevents blurry exports and unexpected cropping.

How Intrinsic Dimensions Are Resolved

  1. If width and height use concrete units (px, pt, in, cm), the converter computes intrinsic pixel size directly.
  2. If width and height are omitted or percentages, the converter derives intrinsic aspect ratio and dimensions from viewBox="minX minY width height".
  3. If both are missing, we default safely to 512×512 px and surface a compatibility notice so you can set explicit output dimensions.

Choosing 1x, 2x, and 3x Export Presets

On modern Retina/HiDPI displays with devicePixelRatio of 2 or 3, a raster image displayed at 200×200 CSS px looks sharpest when backed by a 400×400 (2x) or 600×600 (3x) pixel bitmap. Use the 2x Retina preset in our SVG to WebP Converter or SVG to PNG Converter to multiply the SVG viewBox cleanly before rasterization.

How Fit Modes Work

  • Contain: Keeps the full graphic visible inside W×H, adding transparent/colored padding if aspect ratios differ.
  • Cover: Scales up to fill W×H with no padding, cropping edges that extend beyond the frame.
  • Fill: Stretches X and Y independently to match W×H.
  • Inside / Outside: Prevents upscaling smaller SVGs (inside) or expands the canvas proportionally to avoid clipping (outside).