# Image Resizer

> Resize a photo or logo to an exact width and height or by a percentage, keep its shape, and save it as JPG, PNG or WebP, all in your browser.

Use it online (free, runs in your browser): https://directory.milunir.com/image-tools/image-editors/image-resizer/

To resize an image, choose the file, then enter a new width and height in pixels or pick a percentage. Keeping the shape scales both sides by the same factor, so a 4000 × 3000 photo set to 1200 pixels wide becomes 1200 × 900. The new image appears at once with its file size, ready to download.

Most places that take a picture also set a size: a profile photo of 400 × 400, a blog image no wider than 1200 pixels, a form that refuses files over 2 MB. This resizer handles those jobs in two modes. By pixels takes a width, a height or both, and can either keep the shape of the picture or stretch it to the exact box. By percentage scales both sides at once, from 1% to 400%. You can keep the original format or save a JPG, PNG or WebP copy, and pick the quality for JPG and WebP. Phone photos are turned upright from their orientation tag before resizing, and the saved file does not carry camera details or location data.

## How to use

1. **Choose the image**: Press Choose image or drop a JPG, PNG or WebP file on the box. Files up to 25 MB work.
2. **Set the new size**: In By pixels, type a width, a height or both. In By percentage, move the slider to the size you need.
3. **Pick a format and download**: Keep the same format or choose JPG, PNG or WebP, check the preview and file size, then press the download button.

## Examples

### Fit a 200 × 100 logo into a 100 × 100 box

- Mode: By pixels
- Width (px): 100
- Height (px): 100
- Keep the shape (fit inside width and height): 1
- Size: 50
- Save as: Same as the original
- Quality: 90
- Image: fixture:logo-200x100-alpha.png

Result: New size: 100 × 50 px New size: 100 × 50 px File size: 705 B

Keeping the shape means the longer side sets the scale: 100 ÷ 200 is one half, so the logo becomes 100 × 50 and stays a transparent PNG.

### Halve a sideways phone photo

- Mode: By percentage
- Width (px): 800
- Height (px): 600
- Keep the shape (fit inside width and height): 1
- Size: 50
- Save as: Same as the original
- Quality: 90
- Image: fixture:photo-640x480-orient6.jpg

Result: New size: 240 × 320 px New size: 240 × 320 px File size: 7.7 KB

The file stores 640 × 480 pixels with an orientation tag saying it is a portrait shot. The resizer turns it upright first, so half size is 240 × 320, and the saved file carries no camera tags.

### Make a 200 pixel wide WebP copy

- Mode: By pixels
- Width (px): 200
- Height (px): 0
- Keep the shape (fit inside width and height): 1
- Size: 50
- Save as: WebP
- Quality: 80
- Image: fixture:photo-400x300-gps.jpg

Result: New size: 200 × 150 px New size: 200 × 150 px File size: 1.4 KB

With only a width, the height follows the 4:3 shape: 300 × 200 ÷ 400 is 150. The location data in the original is not copied into the new file.

## How it works

`new width = round(width × s), new height = round(height × s), where s = min(target width ÷ width, target height ÷ height)`

- `width, height`: the size of the upright original in pixels
- `s`: the scale factor; in By percentage it is the percentage divided by 100

The image is first turned upright using its EXIF orientation tag. With the shape kept and both sides given, the smaller of the two ratios sets the scale, so the picture fits inside the box. With one side given, the other follows the same ratio. Without keeping the shape, the image is stretched to the exact width and height. The browser then redraws the pixels at the new size and saves them in the chosen format.

Sources:

- [HTML Standard: the canvas element, toBlob()](https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-toblob), WHATWG

## When not to use it

- For print work that needs a set DPI or a CMYK file; this tool changes pixels only and saves screen images.
- To make a small photo large and sharp; enlarging spreads the same detail over more pixels, so it looks soft.

## Common mistakes

- Typing both a width and a height with Keep the shape turned off, which squashes a 4:3 photo into a square.
- Saving a logo with a transparent background as JPG, which fills the background with white; keep PNG or WebP.

## Questions

### Does resizing an image lower its quality?

Making it smaller keeps it sharp, because pixels are only merged. Making it larger cannot add detail, so a big jump looks soft. Saving as JPG or WebP also drops a little detail; a quality of 85 to 90% is hard to tell apart from the original.

### Why is my resized photo turned the right way when the original looked sideways in some apps?

Phones often store a photo sideways with a tag that says how to turn it. This tool reads that tag, turns the picture upright and saves it that way, so every app shows it the same.

### Is my image uploaded anywhere?

No. The file is opened and resized by your own browser, and nothing is uploaded or stored. The saved copy also leaves out camera details and GPS location.
