Skip to content
Create more with Morphed(opens in a new tab)

Paid AI

Optimization

Image Compression: Lossless vs Lossy, and How to Shrink Files Without Visible Loss

What 'without losing quality' really means, a reproducible JPEG, PNG and WebP benchmark with byte sizes, and how to check the result from ImageWand's compressor.

Author
ImageWand Team
Published
Updated
Reading time
8 min read
Sources checked
November 23, 2026

morphed.app · Paid AI tools

Put this guide to work in a fresh creative project.

Reading "Image Compression: Lossless vs Lossy, and How to Shrink Files Without Visible Loss"?

Explore AI photo editing in Morphed (opens in a new tab)

Paid AI tools. Separate account and upload in Morphed.

A watercolor portrait surrounded by flowers

A portrait with a painterly feel

Soft watercolor, delicate flowers, a pale backdrop.

AI-created concept image. Results vary.

See an example

Smaller file, same pixel dimensions

A measured JPEG quality example. Set the quality or target size for your own image in the compressor.

Original-quality landscape JPEG

Higher quality

640 x 360 px - 117.2 KB

Compressed landscape JPEG

Compressed copy

640 x 360 px - 34.7 KB

"Without losing quality" can mean two different things, and mixing them up causes most compression mistakes:

  • Mathematically lossless: the decoded pixels are exactly the same as the original. PNG and lossless WebP do this.
  • Visually acceptable lossy: some pixel data is thrown away, but the difference is hard to see at normal viewing size. JPEG and lossy WebP do this, and they make much smaller files.

This guide shows the difference with a test you can reproduce, then shows how to check the result from ImageWand's compressor.

Lossless vs lossy in one table

Lossless (PNG, lossless WebP)Lossy (JPEG, lossy WebP)
Pixels after decodingIdentical to the originalApproximately the same
Typical saving on photosSmallLarge
Typical saving on flat graphicsLargeOften worse than lossless
Safe to re-save repeatedlyYesEach save is a new approximation
Good forScreenshots, logos, diagrams, master copiesPhotos for web pages and sharing

MDN's guidance follows the same split: "Photographs and other continuous-tone images can usually tolerate lossy compression," while for "screenshots, diagrams, logos, and line art, prefer lossless encoding" (MDN image format guide).

A reproducible compression benchmark

These results were produced on 23 November 2026 with sharp 0.34.5 (libvips 8.17.3, libwebp 1.6.0, JPEG with sharp defaults: mozjpeg option off, 4:2:0 chroma subsampling). The test images are synthetic and generated by code; the photo-like generator and the downloadable graphic are in the format guide. The numbers are not from ImageWand's in-browser compressor, and a real photo will give different sizes.

PSNR measures how close the decoded file is to the original pixels (higher is closer). It is a simple metric and does not always match what people notice, so the zoomed crops below matter as much as the numbers.

Photo-like image, 1600 x 1000

Encoding (sharp)TypeBytesPSNR
PNG, compressionLevel 9Lossless1,950,426identical
WebP, losslessLossless1,191,190identical
PNG, 256-colour paletteLossy (colour reduction)679,85148.3 dB
JPEG, quality 95Lossy339,23143.0 dB
JPEG, quality 85Lossy128,04841.2 dB
WebP, quality 80Lossy38,94040.6 dB
JPEG, quality 60Lossy52,00939.3 dB
JPEG, quality 30Lossy30,53337.4 dB

Graphic with transparency, 1200 x 750

Encoding (sharp)TypeBytesPSNR
PNG, compressionLevel 9Lossless15,909identical
WebP, losslessLossless4,732identical
PNG, paletteLossy (colour reduction)8,27774.4 dB
JPEG, quality 85, flattened onto whiteLossy31,47737.7 dB
Three zoomed crops of the same hillside and sky. The left crop shows fine grain; the middle crop is smoother; the right crop shows blotchy texture and slight blocking along the hill edge.
The same 200 x 150 crop at 2x zoom, encoded as JPEG quality 95, 60 and 30 with sharp. Grain disappears first; at quality 30, blocks and smeared texture become visible.

What this shows:

  • Lossless saved little on the photo-like image (WebP lossless was 61% of the PNG). Any large reduction on a photo comes from lossy compression.
  • JPEG quality has diminishing returns. Going from quality 95 to 85 cut the file by about 62%; going from 60 to 30 saved much less in bytes but added visible artefacts.
  • For flat graphics, lossless wins. Lossless WebP was smaller than JPEG and kept every pixel and the transparency.
  • Re-saving at the same settings was stable in this test. Re-encoding the quality 85 JPEG nine more times with the same encoder and settings changed PSNR only from 41.2 to 41.1 dB. Losses add up faster when you edit, crop or resize between saves, or switch encoders, so keep an original and export from it.

For a larger test with four kinds of image (photo-like, logo, transparent and text), PSNR and SSIM scores, magnified crops and a script that regenerates every number, see our JPEG, WebP, AVIF and PNG compression benchmark.

Using ImageWand's compressor

The compressor runs in your browser: it processes your image on your device, and the image is not uploaded to ImageWand. It uses the browser's built-in encoders, so the exact bytes differ between browsers and from the sharp numbers above, but the pattern is the same: higher quality keeps more detail, lower quality removes more.

After compressing, check the file size and format the tool reports, and compare the result with the original at 100% zoom. To compress many images, the free batch tool can compress up to 100 images in your browser and download them as one ZIP.

Transparency and JPEG

JPEG has no transparency, so any transparent areas must be filled with a solid colour when an image is saved as JPEG. The HTML standard requires canvas exports to formats without alpha to be composited onto opaque black unless a background is drawn first.

The same teal and orange graphic saved as JPEG twice. On the left the transparent corners have become black; on the right they are white.
A transparent graphic saved as JPEG. Left: flattened onto black, which is what the canvas rule produces when no background is drawn. Right: flattened onto white. Made with sharp to illustrate the general format behaviour; this is not output from ImageWand.

If your image has transparency and you need to keep it, use PNG or WebP: PNG to WebP keeps transparency and usually makes a smaller file. If you need a JPEG, choose JPG output on a white background, then check the edges.

A practical workflow

This is an ImageWand suggestion, not a fixed rule:

  1. Keep the original. Always compress a copy, so you can go back if the result is too soft.
  2. Resize first. Pixel dimensions affect size more than any quality setting. If a photo will be shown at 800 pixels wide, resize it with the resize tool before compressing. See resizing without losing quality.
  3. Pick the format. Photos: JPEG or lossy WebP. Screenshots, logos and transparent graphics: PNG or lossless WebP.
  4. Start with a high quality setting, check the result at 100% zoom, then lower it step by step. Keep the lowest settings for small previews where detail does not matter.
  5. Look at the right places. Smooth gradients (banding), fine texture (smearing) and hard edges such as text (halos and blocks) show artefacts first.
  6. Check the size limit separately. If a site requires a maximum file size, compare the size shown after compressing against it. If it is still too big, reduce pixel dimensions rather than lowering quality further.

Why compression matters for websites

Google's image guidance notes that "images are often the largest contributor to overall page size, which can make pages slow and expensive to load" (Google Search Central). web.dev's advice for Largest Contentful Paint includes reducing image size with optimal sizing, modern formats and compression (web.dev, Optimize LCP). Smaller files help most when the image is the largest element in view; they are not a guarantee of a better ranking on their own.

For responsive markup and measured examples, see the image SEO guide.

Common questions

How do I know if I've compressed too much?

Compare the result with the original at 100% zoom. Look for banding in skies and gradients, blotchy texture, and blocks or halos around edges and text. If you can see them at the size the image will be displayed, use a higher quality.

Should I compress before or after editing?

After. Compression should be the last step, applied to a copy of your edited, full-quality file.

Is a PNG always "better quality" than a JPEG?

A PNG made from a JPEG keeps the JPEG's existing artefacts; converting does not restore lost detail. PNG is only better if it was made from the original, uncompressed source.

What about printing?

Print shops usually want high-resolution files with little or no lossy compression. Ask the printer for their requirements, and send an export from your original rather than a web-compressed copy.

Sources

Platform rules change. These are the official pages this guide was checked against on . Always confirm the current rule before you submit.

  1. Image file type and format guide · MDN Web Docs · accessed
  2. HTML Standard: Serializing bitmaps to a file · WHATWG · accessed
  3. HTMLCanvasElement: toBlob() method · MDN Web Docs · accessed
  4. Optimize Largest Contentful Paint · web.dev · accessed
  5. Google image SEO best practices · Google Search Central · accessed

Frequently asked questions

Can you compress an image without losing any quality?

Yes, with lossless compression such as PNG or lossless WebP: the decoded pixels are identical to the original. The savings are usually modest for photos. Lossy compression such as JPEG makes much smaller files but always changes some pixels; the goal is for the change to be hard to see.

Does ImageWand's compressor upload my image?

No. The compressor runs in your browser: it processes your image on your device, and the image is not uploaded to ImageWand. After compressing, check the file size and format the tool reports.

Why can a transparent PNG get a black or white background when saved as JPEG?

JPEG has no transparency, so transparent areas must be filled with a solid colour. The HTML standard says canvas exports to formats without alpha are composited onto opaque black unless a background is drawn first. To keep transparency, use PNG or WebP. If you need a JPEG, choose JPG output on a white background, then check the edges.

Can I compress an image to an exact file size such as 100 KB?

Lossy encoders take a quality setting, not a byte target, so the size you get depends on the image. Some images cannot reach a very small size without visible damage. Check the file size and format the tool reports after compressing, and reduce the pixel dimensions first if the file is still too large.

Written by

ImageWand Team · Editorial Team

The ImageWand editorial team writes practical guides on image editing, file formats, compression, and platform-specific image requirements. Each guide lists the official sources we checked and when, and says plainly which steps ImageWand can and cannot do. About ImageWand