Image Compression: Smaller Files Without Losing Quality
Image compression works two ways. Lossless strips out unnecessary data without touching quality at all. Lossy sacrifices small details you won't notice by eye to produce a much smaller file.
Summary
Image compression works two ways. Lossless strips out unnecessary data without touching quality at all. Lossy sacrifices small details you won't notice by eye to produce a much smaller file.
Step by step
- Pick the method based on where the image is going: lossy is usually fine for the web and gives a smaller file, lossless is safer for print.
- After compressing, check the image at full size, especially around sharp edges like text or logos, for visible distortion.
- Think about format too. JPEG or WebP generally work better for photos, PNG for anything that needs transparency.
- If you're using the same image at multiple sizes, compress each size separately. Shrinking one big file with CSS just wastes bandwidth.
Why it matters
Uncompressed images pile up quietly. A few large photos on a web page can noticeably slow it down, especially on mobile data. Email attachments hit size limits, application forms reject your file, and cloud storage fills up faster than you expected. Compression fixes most of this while changing the image very little, or not at all.
How to pick a quality setting
Most lossy compression tools give you a quality slider, and there's no single right number. It depends on what's in the picture. A practical approach: start high, lower it step by step, and look at the result at full size each time. Stop a notch or two above the point where you first see damage. Large flat areas and smooth gradients, like a clear sky or a studio backdrop, show artifacts first. A busy forest scene can look fine at a much lower setting.
Common mistakes
- Running lossy compression again on a JPG that's already compressed. You gain little and the damage adds up.
- Saving over the original. Always keep the compressed version as a separate file.
- Compressing first and resizing second. Do it the other way round: shrink to the pixel size you need, then compress.
- Judging the result in a tiny preview window, where everything looks fine.
A worked scenario
A travel blogger wants to add ten phone photos to a post. They're at full phone resolution, but the post's content column is much narrower. First she resizes each photo to twice the column width, so they stay sharp on high-density screens. Then she applies lossy compression and spots slight banding in the sky of a sea view. She bumps the quality up for that one photo and leaves the rest as they are. The post's total image weight drops a lot, and readers can't tell.
When not to compress
Skip lossy compression on originals you want to archive, on working files you'll edit again later, and on images headed for print. Compress a separate copy for sharing and keep the original untouched.