Resize an image to exact dimensions

Resize an image to target dimensions while optionally preserving its aspect ratio.

freeworks offlinenothing uploaded
ToolImage Resizer
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The source bitmap is sampled into a destination width and height using an interpolation filter; preserving aspect ratio derives one dimension from the other. Resampling changes pixel count and cannot restore detail lost in a smaller source.

  • Explicit dimensions control output bytes while aspect preservation avoids distortion.

Worked example

Fit an image inside 800 by 600
Input
											Input: data:image/png;base64,iVBORw0KGgo=
Width: 800
Height: 600
Maintain aspect ratio: true
										
Output
												PNG data URL scaled to fit within an 800×600 box without stretching
											

When to use this

Responsive thumbnails, upload optimization, and raster exports resize images.

Edge cases

  • Upscaling interpolates pixels rather than recovering detail.
  • Nonuniform dimensions stretch circles and faces.
  • Repeated resize operations compound interpolation blur.

References