Toolwise
Image Tools

Image Compression Explained: Lossy vs Lossless and the Quality Sweet Spot

By the GrainZap Team7 min read
image compressionjpgpngfile sizeimage quality
Advertisement

A photo straight off a modern phone is typically 3-6MB. The same photo can usually be brought under 1MB with no difference most people can see — which is why image compression is the single most effective thing you can do for a slow web page, a full inbox or an upload form with a size limit.

Compression isn't magic, though, and it isn't free. Knowing what it removes, and when, lets you pick settings deliberately instead of dragging a slider until the number looks small enough.

What compression actually does

An uncompressed image is just a grid of pixels, each storing a colour value. A 12-megapixel photo at 3 bytes per pixel is around 36MB of raw data. Compression shrinks that in one of two fundamentally different ways.

Lossless compression: removing redundancy

Lossless compression, used by PNG, finds patterns in the data and describes them more efficiently — a run of 500 identical white pixels stored as "white, 500 times" rather than 500 separate values. Decompressing it reconstructs every pixel exactly, so nothing is ever lost and the image can be saved again and again without changing.

The limitation is that it can only remove redundancy that actually exists. Screenshots, logos and diagrams have large areas of identical colour and compress very well. Photographs have almost none — neighbouring pixels are similar but rarely identical — so lossless compression achieves comparatively little on them.

Lossy compression: discarding what you won't miss

Lossy compression, used by JPG, deliberately throws away information the eye is poor at noticing — fine colour detail and subtle high-frequency texture in particular. The result is an approximation of the original, not a copy, but the approximation can be many times smaller. A quality setting controls how much is discarded: higher quality keeps more detail and produces a bigger file.

What's discarded is gone permanently. There is no way to recover it from the compressed file, which is why you should always keep the original.

Why 100% quality still isn't the original

It's natural to assume a JPG saved at 100% quality is lossless. It isn't. JPG encoding converts colours into a different colour space, splits the image into 8 × 8 pixel blocks, transforms each block into frequency components and rounds those values before storing them. Even at the top setting, that rounding — plus the colour conversion and, in many encoders, reduced-resolution colour channels — means the decoded pixels differ slightly from the source.

At 100% the differences are invisible, but they're real, and the file is often dramatically larger than at 90% for no visible benefit. Maximum quality is rarely a sensible setting; if you genuinely need a bit-for-bit copy, you need a lossless format.

Finding the quality-versus-size sweet spot

File size doesn't fall evenly as you lower quality. The first steps down from 100 save a great deal of space while costing almost nothing visually; the savings then taper off, while the visible damage accelerates. For typical photographs, the practical pattern looks like this:

  • 90-100: visually indistinguishable from the original, but files are large. Useful only for archival or professional print masters.
  • 75-85: the sweet spot for most photos. Compared with a camera original, a 60-80% size reduction is common here, with differences that are very hard to spot at normal viewing size.
  • 60-75: still acceptable for thumbnails and small web images, with occasional softness in fine detail.
  • Below 60: artifacts become obvious — visible 8 × 8 blocking, blotchy banding in skies and smooth gradients, and halos around sharp edges and text.

Skies, skin tones and smooth gradients show damage first, because blocking is most obvious where colour should change gradually. Busy, detailed scenes like foliage hide artifacts well and tolerate lower settings. Always judge the result at the size it will actually be viewed, and zoom in on the smoothest area of the image.

Tip

Start at 80% and compare the preview against the original, zoomed in on a sky or gradient. If you can't see a difference, try 75%; if you can, go back up to 85%. Two or three comparisons are usually enough to find the right setting for a given image.

Generation loss: why re-compressing hurts

Every time a JPG is decoded and saved as a JPG again, the encoder rounds the data again and discards a little more. Do it repeatedly — edit, save, send, edit, save — and the damage accumulates: edges soften, colours drift, and blocking creeps in even though each individual save used a reasonable quality setting. This is known as generation loss.

It also explains a common surprise: compressing a photo that was already heavily compressed often saves very little, and can even produce a larger file, because there's little fine detail left to discard. If the output is bigger than the input, the image was already compressed further than your chosen setting — keep the original instead.

Watch out

Always compress from the original, never from a previously compressed copy. Photos saved from messaging apps and social media have usually been recompressed already, so compressing them again stacks a second round of losses on the first.

Practical settings for common uses

The right setting depends on where the image is going, not on the image alone:

  • Websites: prioritise small files, since image weight is usually the biggest factor in page load time. Use 70-80% quality, and resize to the largest size the image is actually displayed at before compressing — a 4000-pixel photo shown 800 pixels wide wastes most of its bytes. WebP typically gives a smaller file than JPG at similar quality.
  • Print: prioritise quality. Use 90% or higher, keep full resolution, and ideally send the original file. Print shows detail and gradients that a screen hides, and printers rarely have file-size constraints.
  • Email and uploads: balance the two. Around 75-80% is usually right, which lets several photos fit under a typical 20-25MB attachment limit while still looking good if the recipient prints them. For strict upload caps, reduce pixel dimensions before dropping quality below 70%.
  • Screenshots, logos and text: use PNG. Lossy compression puts visible halos around text and sharp edges, and PNG usually compresses this kind of content efficiently anyway.

Frequently asked questions

Does compressing an image reduce its resolution?

Not by itself. Compression changes how the pixels are stored, not how many there are, so a 4000 × 3000 image is still 4000 × 3000 after compression. Reducing the pixel dimensions is a separate step called resizing, and combining the two gives the biggest overall size reduction.

Why doesn't the quality slider work for PNG?

Because PNG is lossless — there is nothing to trade away. A PNG always stores every pixel exactly, so its size depends on the image content rather than a quality setting. To make a photographic PNG dramatically smaller, convert it to JPG or WebP, where the quality slider applies.

Is it safe to compress images online?

It depends on the tool. Toolwise's Image Compressor processes images in your browser, so the file isn't uploaded to a server to be compressed. For any tool, check whether processing happens locally or on a remote server before compressing sensitive images such as ID documents.

In short: use lossless for graphics and text, lossy for photos, aim for 75-85% quality as a starting point, compress from the original every time, and match the setting to the destination — smaller for the web, higher for print, and a sensible middle for email.

Advertisement

Ready to put this into practice?

Compress an Image Free

More guides