How to resize an image to a chosen size

Enter the width and height you need, choose how the picture fits, and the result is drawn on a canvas in this browser. Fit inside keeps the whole picture and pads the rest, Fill and crop covers the frame and cuts the edges away, Stretch matches the frame exactly and changes the proportions. The result is previewed and downloaded as PNG, JPEG or WebP with the new size in its file name.

Measured in this browser: a 240×60 picture resized to 120×120 finished in about 10–25 ms, the fitted PNG (1.6 KB) kept its bands with padding around them, and the cropped one (857 B) lost the outer bands. A run answers in milliseconds whatever the size; the fields, the preview and the three measurements are what tell you what happened.

  1. Drop an image into the workbench or choose one. The tool works on a single file: choosing another replaces the first, and a file that is not an image is refused with a message while the loaded image stays.
  2. Type the width and height in pixels. A field left blank keeps the source dimension — 240×60 with a blank width and a height of 60 came out 240×60 — and the numbers actually used are written back after the run. Values below 1 px are refused, and decimals are rounded: 100.6 and 60.4 became 101×60.
  3. Choose how the picture fits. Fit inside scales the whole image into the frame and pads the shorter side, Fill and crop scales it up and crops the longer side, Stretch uses the frame exactly. The padding is painted with the background colour, or left transparent when Keep transparency is selected, which is the default for PNG and WebP.
  4. Pick the output format: PNG, JPEG or WebP. Quality applies to JPEG and WebP between 10 and 100; a blank or 0 field falls back to 88 and the corrected number is written back. JPEG has no alpha channel, so transparent areas are painted with the background colour there.
  5. Press Process files, check the preview and the measurements (input size, output size, result dimensions), then download: the file is named after the source with the new size, for example wide-240x60-120x120.png. Download before a run, or after Clear, answers with a message instead of doing nothing, and Clear empties the preview and the measurements.

What the fit modes do and which sizes the browser refuses

The same picture in the three fit modes

One 240×60 source of three colour bands, asked for 120×120: Fit inside scaled the whole image to 120×30 and padded above and below, Fill and crop scaled it to 120×120 and cut the outer bands away, and Stretch drew all three bands into the frame with changed proportions. The measurements name the size of the result, so the mode can be checked without opening the file.

The padding is painted with the background colour. PNG and WebP keep transparency instead when Keep transparency is selected, which is the default here as it is in the convert and batch tools, so a logo placed in a larger frame keeps a transparent border. JPEG has no alpha channel, so its transparent areas are always painted with the background colour.

Sizes the browser refuses

The canvas the browser can encode sets the ceiling: 16384 px per side and 32 megapixels in total. 16384×60 finished with a 7.1 KB PNG, 16385×60 stopped with the limit message that names both numbers, and 70000 px no longer answered "This browser cannot decode that file format." but the same limit message.

Width and height take whole numbers of 1 px or more: 0 and -5 are refused with a message instead of quietly becoming the source size or a one-pixel image, and the reason is written in the status line. A blank field keeps the source dimension, and the numbers that were used are written back into the fields after the run, so the form always shows the size that was used.

Sources that are not plain bitmaps

An animated GIF is processed as its first frame. An SVG is drawn at its own size and then resized like any other picture — a 60×30 icon asked for 120×60 came out at 120×60. A JPEG whose EXIF says the camera was turned is drawn the way viewers show it: a 40×24 file with orientation 6 came out 24×40, and the new file carries no EXIF, because the result is re-encoded from the visible pixels.

A damaged, empty or renamed file answers "This browser cannot decode that file format." and nothing is written; a rejected file type keeps the image that was already loaded. Downloading with nothing to serve says "Resize an image first, then download the result." instead of throwing an error, and Clear removes the loaded image, the preview and the measurements.

Recent tools: