How to Reduce Image File Size Without Losing Quality
Your images are too large. Your website is slow. Your email bounces. Here's how to shrink file sizes by 60 to 90% while keeping images that look identical to the originals.
Why image file size matters
Large images cause real problems. A 5 MB hero image takes over 4 seconds to load on a typical mobile connection. Email providers reject attachments over 25 MB. Slack and Discord impose their own limits. Cloud storage fills up. And if you run a website, Google directly penalizes slow pages in search rankings.
The fix is not complicated. Most images contain far more data than the human eye can perceive. A 12-megapixel photo at maximum quality might be 8 MB. Compress it properly and it drops to 400 KB. Side by side, you cannot tell the difference. The trick is knowing which settings to use and which format to pick.
Google PageSpeed Insights consistently flags unoptimized images as the number one performance issue on most websites. Fixing images is the highest-impact change you can make to page load speed.
Lossy vs lossless compression
Every image compression technique falls into one of two categories. Understanding the difference is the foundation for every decision that follows.
Lossless compression reduces file size by finding more efficient ways to store the same data. Every pixel is preserved exactly. You can decompress the file and get back the original, bit for bit. PNG uses lossless compression. So does WebP in its lossless mode. The downside: lossless compression ratios are modest. A PNG might be 30 to 50% smaller than raw pixel data, but that still leaves large files for complex photographs.
Lossy compression discards information that the human eye is unlikely to notice. It exploits how human vision works: we are more sensitive to brightness changes than color changes, and we are bad at perceiving fine detail in busy areas of an image. JPEG, lossy WebP, and AVIF all use this approach. The result: dramatically smaller files (often 80 to 95% smaller than the original) with no perceptible quality difference at the right settings.
| Aspect | Lossless | Lossy |
|---|---|---|
| File size reduction | 30-50% from raw | 80-95% from raw |
| Quality | Bit-perfect original | Visually identical at high settings |
| Best for | Text screenshots, medical images, technical diagrams | Photos, web images, social media, email |
| Formats | PNG, WebP lossless, TIFF (LZW) | JPEG, WebP lossy, AVIF, HEIC |
| Repeated saves | No degradation | Each save loses more data (generation loss) |
For most people, lossy compression at quality 80 to 85 is the right choice. The files are 5 to 10 times smaller and the visual difference is imperceptible without zooming in to 300% and comparing side by side.
Choosing the right format
Format selection is the single highest-leverage decision for reducing image file size. The same photograph compressed at the same perceptual quality can vary by 50% or more in file size depending on the format.
| Format | Avg file size (quality 80, 12MP photo) | Browser support | Transparency | Best use case |
|---|---|---|---|---|
| JPEG | 520 KB | Universal | No | Maximum compatibility |
| WebP | 380 KB | 97%+ global | Yes | Default web format in 2026 |
| AVIF | 290 KB | 92%+ global | Yes | Maximum compression |
| PNG | 4.2 MB | Universal | Yes | Lossless only (screenshots, diagrams) |
| HEIC | 340 KB | Apple devices only | No | iPhone photo storage |
If your images are for the web: use WebP. It is supported everywhere that matters and compresses 25 to 35% better than JPEG. If you need maximum compression and can provide a WebP fallback: use AVIF. If compatibility is paramount (email, legacy systems): stick with JPEG.
ConvX makes format conversion trivial:
convx convert photo.jpg --to webp -q 82That single command switches format and compresses in one step. Quality 82 is the sweet spot where WebP files are dramatically smaller than JPEG with no visible difference. See the full options in the CLI reference.
Quality settings: finding the sweet spot
The quality parameter (0 to 100) controls how aggressively the encoder discards data. Higher numbers keep more detail. Lower numbers produce smaller files. But the relationship is not linear. The biggest file size savings happen between quality 100 and quality 85. Below quality 70, files get only marginally smaller while artifacts become noticeable.
Here is a real-world example. A 24-megapixel DSLR photo (6000x4000 pixels), originally 7.8 MB as JPEG quality 100, converted to WebP at various quality levels:
| Quality | File size | Size vs original | Visual assessment |
|---|---|---|---|
| 100 | 2.9 MB | 37% | Identical to source |
| 90 | 710 KB | 9.1% | Imperceptible difference |
| 82 | 420 KB | 5.4% | No visible difference at normal viewing |
| 75 | 310 KB | 4.0% | Slight softening in fine textures at 200% zoom |
| 60 | 200 KB | 2.6% | Noticeable in gradients and skin tones at 100% |
| 40 | 130 KB | 1.7% | Clear blocking artifacts. Thumbnails only. |
Quality 82 reduces the file by 95% with no visible difference at normal viewing distance. That is the setting ConvX uses as its default for web-optimized images. For the science behind why this works, see web.dev's guide on image formats and compression.
Resolution vs compression
Compression and resolution are two independent levers for reducing file size. Many people focus only on compression but ignore resolution, which is often the bigger win.
A 12-megapixel photo (4000x3000 pixels) displayed in a 800px-wide container on a website is wasting 96% of its pixels. The browser downloads all 12 million pixels and then throws away most of them during rendering. Resizing the image to 1600 pixels wide (for 2x Retina) before uploading eliminates that waste at the source.
| Approach | Original | Compress only (q82) | Resize only (1600px) | Resize + compress |
|---|---|---|---|---|
| Dimensions | 4000x3000 | 4000x3000 | 1600x1200 | 1600x1200 |
| Format | JPEG q100 | WebP q82 | JPEG q100 | WebP q82 |
| File size | 7.8 MB | 420 KB | 1.3 MB | 95 KB |
| Reduction | Baseline | 95% | 83% | 99% |
Combining both techniques takes a 7.8 MB image down to 95 KB. That is an 82x reduction. The image still looks sharp at its display size on a Retina screen.
convx convert photo.jpg --to webp -q 82 --width 1600Metadata stripping
Every photo from a camera or phone carries EXIF metadata: GPS coordinates, camera model, timestamp, lens data, ISO settings, and sometimes an embedded thumbnail. This metadata adds 10 to 100 KB per image. For a single photo, that is negligible. For a page with 20 images, it is 200 KB to 2 MB of invisible data that your visitors download but never see.
Beyond file size, metadata poses a privacy risk. EXIF GPS data is accurate to within a few meters. Publishing a photo with GPS data intact reveals the exact location where it was taken. Camera serial numbers can link photos across websites to the same device.
ConvX strips metadata by default when converting to web formats. The pixel data remains untouched; only the metadata is removed.
Bulk optimization
Optimizing one image at a time is impractical when you have hundreds or thousands. ConvX supports bulk conversion with parallel processing:
convx convert images/ --to webp -q 80 -j 4This converts every image in the images/ directory to WebP at quality 80 using 4 parallel jobs. On a modern 8-core machine, you can increase -j to 8 for even faster throughput. ConvX shows a progress bar for each file and a total count.
For a directory of mixed formats (JPEG, PNG, TIFF, BMP):
convx convert "images/*.{jpg,png,tiff,bmp}" --to webp -q 80 -j 4 -d ./optimizedThe -d flag sends output to a separate directory so your originals remain untouched. This is a non-destructive workflow: you always keep the source files.
For ongoing optimization, use watch mode:
convx watch ./uploads --to webp -q 80 --filter "*.png,*.jpg"Every new image dropped into the uploads folder gets optimized automatically. This is ideal for CMS workflows where content editors add images that need compression before going live.
AI-powered optimization via MCP
You: "Reduce all images in my project to under 200KB each"
Claude (via MCP): batch_convert({
input_paths: ["./src/assets/images/*"],
output_format: "webp",
quality: 78,
max_width: 1600
})ConvX's MCP server lets AI assistants call conversion tools through natural language. You describe the goal; the AI picks the right parameters. No command memorization required.
When to use each approach
Not every image needs the same treatment. Here is a decision guide based on the use case.
| Use case | Recommended format | Quality | Resize? | Expected result |
|---|---|---|---|---|
| Website hero image | WebP or AVIF | 80-85 | Yes, max 2000px wide | 100-300 KB |
| Blog post images | WebP | 78-82 | Yes, max 1200px wide | 50-150 KB |
| Product photos (e-commerce) | WebP with JPEG fallback | 82-88 | Yes, max 1600px wide | 80-250 KB |
| Email attachments | JPEG | 80 | Yes, max 1600px | 150-400 KB |
| Social media | JPEG or PNG | 85 | Per platform specs | 200-500 KB |
| Thumbnails | WebP | 70-75 | Yes, max 400px | 10-30 KB |
| Archival / source files | PNG or TIFF | Lossless | No | Full size preserved |
Common mistakes to avoid
Re-compressing already compressed images. If you take a JPEG at quality 80 and re-save it at quality 80, the file does not stay the same. It gets worse. Each lossy compression cycle discards more data. This is called generation loss. Always work from the highest-quality source file you have. If you only have a compressed JPEG, do not re-compress it at a lower quality. Convert formats instead (JPEG to WebP) because the WebP encoder works from the decoded pixel data, not the JPEG compression artifacts.
Using PNG for photographs. PNG is lossless, which means huge files for complex images. A 12 MP photo is 4 to 8 MB in PNG versus 300 to 500 KB in WebP at quality 82. Use PNG only for screenshots, diagrams, and images with text where lossless preservation matters.
Ignoring resolution. Compressing a 6000px-wide image to quality 60 produces a small file with visible artifacts. Resizing it to 1600px and compressing at quality 82 produces a smaller file that looks better. Resize first, then compress.
Stripping metadata from archival copies. Metadata is useful for organizing photo libraries (date, camera, location). Strip metadata from web copies and email attachments, but keep it on your originals.
Using the desktop app
Drag your images into ConvX. Select the output format (WebP is the default recommendation). Adjust the quality slider. The app shows a real-time preview and the estimated output file size so you can see the tradeoff before committing. For bulk operations, drag a folder or select multiple files. Click convert.
Troubleshooting
Image looks fine on my screen but blurry on mobile
Mobile screens are often Retina (2x or 3x pixel density). An image that is 800 pixels wide looks sharp on a standard display but blurry on a phone that renders it at 2x. Serve images at 2x the display size. If your image container is 400px wide, the image should be at least 800 pixels wide. For 3x displays (some Android phones), use 1200 pixels.
Colors look washed out after converting to WebP
This is a color profile issue. Photos from iPhones and DSLRs use Display P3 or Adobe RGB color profiles. WebP viewers (browsers) assume sRGB unless told otherwise. If the converter does not translate the color profile, colors appear muted. ConvX converts to sRGB automatically during web image optimization. If you are using other tools, ensure they handle ICC profile conversion.
File size barely changed after compression
This usually means the image was already well-compressed. A JPEG at quality 70 does not get much smaller by converting to WebP at quality 80. The improvement is largest when starting from uncompressed or lightly compressed sources (PNG, TIFF, camera RAW, high-quality JPEG). Check the source file's current compression level before expecting dramatic reductions.
Batch conversion is slow
Increase the parallelism with the -j flag. The default is one job at a time. On an 8-core CPU, use -j 8. AVIF encoding is particularly slow (3 to 5 times slower than WebP). If speed matters more than maximum compression, use WebP instead of AVIF. For large batches, Squoosh can help you test individual images interactively before committing to batch settings.
Transparent background turned black
JPEG does not support transparency. If you convert a PNG with an alpha channel to JPEG, transparent areas become black (or sometimes white, depending on the tool). Use WebP instead. WebP supports alpha channels with excellent compression. If you must use JPEG, flatten the transparency to a white background first:
convx convert logo.png --to jpg -q 85 --bg white