pythonware.com

Home / Image tools / any size

Byte budget

Compress an image to any size

Type the number the form is asking for. Anything from a few kilobytes to a few megabytes, whether that is 30 KB, 64 KB, 150 KB or 2 MB.

Drop a file here or click to browse — any image

Common targets

Result

--limit --
0 → limit

One page instead of a page per number

Upload limits come in every value somebody could think of. This page takes the number directly rather than pretending each one needs its own tool, and the method is the same whatever you type: encode, measure, adjust, repeat.

The tool runs a binary search over JPEG quality, measuring the real byte count each time rather than estimating it. If quality alone cannot get under your target it starts reducing the dimensions in steps and searches again. It stops at the first result that fits, so you get the best quality that satisfies the limit rather than the smallest possible file.

When to lock the dimensions

Tick the box when a form has specified pixel dimensions as well as a file size, which exam and recruitment portals routinely do. The tool will then only adjust quality. If the target is very small and the image is large, locking may make it impossible, and the tool will tell you it fell short rather than quietly delivering something over the limit.

If the result is too small

Some forms specify a minimum as well as a maximum. If you land under the floor, do not re-save at higher quality and hope. Use increase image size in KB, which pads the file without touching the picture.

Common questions

How do I compress an image to exactly 30 KB?

Type 30 and press compress. You will get something a little under 30 KB rather than exactly 30, because JPEG quality is a coarse dial and no encoder can be told to produce a precise byte count. Under the limit is what an upload check tests for.

Why does it stop before reaching my target?

Either the dimensions are locked and quality alone cannot get there, or the image has already reached the floor of what JPEG can do at those dimensions. Untick the lock, or set a longest edge, and it will have room to work.

Is there a size below which the picture is ruined?

It depends far more on dimensions than on the target. A 300 pixel wide photo at 20 KB looks fine; a 3000 pixel wide one at 20 KB does not. If quality matters, reduce the dimensions to what the image will actually be displayed at first.

Other image tools