# Image Resizer

> Resizes a PNG, JPEG, WebP or GIF to a box, a width, a height, a percentage or an exact size, and writes it back as PNG or JPEG. The decoding, the resampling and the encoding all happen in this browser tab.

Use it: https://tessalor.com/en/image/image-resizer

This tool runs entirely in the browser. Nothing entered into it is uploaded.

## How it is done

1. Read the first bytes of the chosen file and work out from them alone whether it is a PNG, a JPEG, a WebP or a GIF, and how many pixels it claims to contain. The file's declared type is not consulted, because Safari reports a HEIC with no type at all.
2. Refuse anything above 80 megapixels here, before allocating a byte. A decoded image costs four bytes a pixel whatever the file size, so a 100-megapixel panorama is 400 MB of memory that a browser tab does not have.
3. Decode the image with the browser's own decoder, asking explicitly for the EXIF orientation to be applied, so a photo shot in portrait is measured the way it looks rather than the way the sensor recorded it.
4. Work out one scale factor from the decoded dimensions and multiply both sides by it, rounding each to a whole pixel. Only the exact-size mode uses two factors, and only because it has been told to ignore the proportions.
5. Halve the image repeatedly until one more halving would overshoot, then draw the last step straight to the target. A browser resamples with a small kernel, so a single 10x reduction samples about one pixel in ten and throws the rest away.
6. Fill the canvas with the matte colour first when the output is JPEG, because JPEG has no alpha channel and a transparent pixel has to become something.
7. Encode the final canvas as PNG or JPEG, read back the type the browser says it actually wrote, and offer it as a download named after the original with the new dimensions appended.

## Assumptions

- Both sides are scaled by one factor and then rounded to whole pixels, so the proportions can shift by up to half a pixel. On a 4000-pixel photo that is a change of about 0.01%, and it is the only way to avoid a much larger drift from rounding the two sides independently.
- EXIF orientation is applied. A photo whose file header says 4000 by 3000 but which carries a quarter-turn tag is treated as 3000 by 4000, because that is what you see in your photo viewer and what every dimension below it has to agree with.
- The toggle called "Never make it bigger" applies to the box, width and height modes, which describe a target the image must fit inside. A percentage or an exact size is taken literally, so 200% does enlarge.
- Only the first frame of an animated GIF or WebP survives. A canvas holds one frame, and re-assembling an animation would need an encoder the browser does not expose.
- An embedded colour profile is usually dropped. Most engines convert a wide-gamut photo to sRGB when it is drawn to a canvas, so an Adobe RGB image can come back looking slightly flatter than the original.
- A JPEG is decoded and re-encoded, never copied. Even at 100% quality that loses a little more detail, which is why "keep the original format" writes a WebP or a GIF out as lossless PNG rather than as JPEG.
- KB means 1,024 bytes and MB means 1,024 KB, which is what a desktop file manager shows and therefore what the figure gets compared against.

## Inputs

| Name | Label | Type | Default | Range |
| --- | --- | --- | --- | --- |
| `source` | Image | file | chosen on your device | image/png, image/jpeg, image/webp, image/gif, up to 40 MB |
| `mode` | How to resize | select | fit |  |
| `width` | Width | integer | 1200 | 1 to 20000 |
| `height` | Height | integer | 1200 | 1 to 20000 |
| `scale` | Scale | percent | 50 | 1 to 400 |
| `format` | Write it as | select | auto |  |
| `quality` | JPEG quality | percent | 82 | 1 to 100 |
| `noEnlarge` | Never make it bigger | toggle | true |  |
| `matte` | Background behind transparency | select | white |  |

## Outputs

- `newSize` — New size (text), primary
- `originalSize` — Original size (text)
- `fileSize` — New file size (text)
- `sizeReduction` — Smaller by (percent)
- `outputFormat` — Written as (text)

## Questions

### Is my image uploaded anywhere?

No. The file is read in this browser tab and resized by a worker running on your own machine, using the same image decoder the browser uses to display a photograph on any other page. There is no server to send it to, and the automated test for this page fails if any request leaves this site while an image is loaded.

### Why is my animated GIF now a single frame?

Because a canvas holds one frame at a time. The first frame is decoded, resized and written out, and the rest are discarded. Resizing an animation properly needs an encoder that can write the frames back with their timings, and a browser does not expose one for GIF or for WebP.

### Why did the file get bigger instead of smaller?

Usually because a photograph was written out as PNG. PNG is lossless, so a photograph re-encoded as PNG can be several times the size of the JPEG it came from even at a fraction of the pixels. Choose JPEG under "Write it as" and the file will be far smaller. The other cause is a very small image, where the format's fixed overhead is most of the file.

### Why will it not make my small photo bigger?

"Never make it bigger" is on by default, and the box, width and height modes respect it. Enlarging invents pixels: a 600-pixel photo stretched to 1920 is a bigger, blurrier file with no more detail in it. Turn the toggle off under "More options" if you want it anyway, or use the percentage mode, which is taken literally.

### Can I resize a HEIC photo from my iPhone?

Not here. HEIC and AVIF are refused with a message saying so, because the browser's canvas cannot reliably decode either one and a half-decoded photo is worse than a refusal. Export the photo as JPEG from the Photos app, or set the camera to "Most Compatible", and it will resize normally.

### Do the colours change?

Slightly, if the original carried a wide-gamut colour profile. Drawing an image to a canvas converts it to the canvas colour space, which is sRGB in most engines, so an Adobe RGB or Display P3 photo can come back looking a little flatter. An sRGB image, which is nearly everything from the web, is unaffected.

## Sources

- [HTML Standard, the canvas element](https://html.spec.whatwg.org/multipage/canvas.html) — WHATWG, applies to 2026. Retrieved 2026-07-30.
- [HTML Standard, ImageBitmap and animations](https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html) — WHATWG, applies to 2026. Retrieved 2026-07-30.
- [Portable Network Graphics (PNG) Specification (Third Edition)](https://www.w3.org/TR/png-3/) — W3C, applies to W3C Recommendation, 24 June 2025. Retrieved 2026-07-30.
- [Recommendation T.81: Digital compression and coding of continuous-tone still images](https://www.itu.int/rec/T-REC-T.81) — ITU-T. Retrieved 2026-07-30.
- [WebP Container Specification](https://developers.google.com/speed/webp/docs/riff_container) — Google, applies to 2026. Retrieved 2026-07-30.
- [Graphics Interchange Format Version 89a](https://www.w3.org/Graphics/GIF/spec-gif89a.txt) — CompuServe. Retrieved 2026-07-30.

## Variants

- [How do I resize a photo to 1920 pixels wide?](https://tessalor.com/en/image/image-resizer/to-1920-wide)
- [How do I make a picture half the size?](https://tessalor.com/en/image/image-resizer/half-the-size)

---

Estimate, not advice. See https://tessalor.com/en/disclaimer.
Machine-readable catalogue: https://tessalor.com/api/tools.json
