Image Compressor
Our Image Compressor reduces the file size of a JPG, PNG, WEBP, GIF, or BMP image without changing its pixel dimensions. The compression strategy is format-aware: JPG and WEBP use a quality slider you control, PNG is optimized losslessly with optipng when available (GD's max compression otherwise), and GIF and BMP are re-encoded through GD.
How to Use the Image Compressor
1. Upload Your Image
- Drag and drop a JPG, PNG, WEBP, GIF, or BMP file onto the drop zone
- Or click to browse and select a file from your device
- Files up to 10MB are supported
2. Pick a Quality (JPG / WEBP)
- The quality slider appears for JPG and WEBP only. It defaults to 75 — a good general-purpose value that produces files 50-70% smaller than a quality-100 export with virtually no visible difference for most photos.
- For PNG, GIF, and BMP the slider is hidden and replaced with an explanatory note. PNG is always optimized losslessly, GIF is re-encoded through GD's LZW packer, and BMP is uncompressed by definition.
- Drag the slider lower (down to 1) to shrink further at the cost of visible compression artifacts. Drag it higher (up to 100) for near-lossless output.
3. Preview and Download
- The compressed image keeps the same file format as the original
- The result panel shows the original size, the compressed size, and the percent saved
- The filename is suffixed with
-compressed(for example,photo-compressed.jpg) - Download with one click
Key Features
Per-Format Compression Strategy
- JPG re-encodes at the slider's quality value. 75 is a solid general-purpose default; 60-70 is great for web uploads; 90+ is appropriate for archival work.
- WEBP re-encodes at the slider's quality value. WEBP at the same visual quality is typically 25-35% smaller than JPG.
- PNG is optimized losslessly. When
optipngis available on the server, it's used (with a 5-second timeout) to re-run the deflate pass at a higher trial count — usually 20-40% smaller than a GD export. Whenoptipngisn't available, GD'simagepng($image, null, 9)(max compression) is used as a fallback. - GIF is re-encoded through GD. The format is already LZW-compressed, so savings are typically modest (5-15%), but the re-encode can still tighten frame packing.
- BMP is re-encoded through GD for consistency. BMP is uncompressed by definition, so the output size will essentially match the source's uncompressed raster size.
Live Size Comparison
- The result panel shows the original file size, the compressed file size, and the percent saved
- The percent is calculated as
(original - compressed) / original * 100, clamped to 0 - This lets you immediately see whether a lower quality is worth the size savings
Format Preservation
- The compressed file uses the same format as the original (JPG → JPG, PNG → PNG, etc.)
- PNG, WEBP, and GIF keep their transparency
- JPG and BMP have transparent pixels filled with white (those formats don't support transparency)
Use Cases
1. Web and Email Attachments
- Shrink a photo before emailing it (most clients cap attachments at 10-25MB)
- Reduce JPG/WEBP file size before uploading to a CMS that has a per-file size cap
- Optimize images for fast page loads (smaller files = faster LCP)
2. Mobile and Camera Roll Cleanup
- iPhone HEIC photos are smaller than JPG, but many apps and websites still need JPG — run them through the Image Converter first, then compress the JPG output
- Compress a batch of screenshots before archiving them
- Reduce phone-camera JPGs (often 3-8MB) to a web-friendly size (300-800KB) with no visible quality loss
3. Social Media Prep
- Compress a photo to under a platform's upload limit (Instagram's in-feed photo limit, X's image size cap, etc.)
- Compress a profile photo to a smaller avatar size before uploading
4. PNG Optimization for Web
- A typical PNG screenshot or icon is 20-50% smaller after optipng optimization with zero pixel difference
- Use this tool as a "save for web" pass on UI screenshots, app store graphics, or any asset that ships as PNG
5. Storage and Backup
- Compress a folder of images before backing it up to free cloud-storage space
- Reduce the size of a document's embedded images before archiving the document
Technical Features
- Server-Side Processing: Compression runs on the server with PHP's GD extension — accurate and reliable
- optipng Acceleration: PNG compression shells out to
optipngwhen the binary is on the server's PATH. The shell-out is wrapped in a 5-second timeout and atry/finallycleanup that always removes the temporary file, even if the request errors out. Ifoptipngis missing or produces a larger file, the request silently falls back to GD's max compression. - Format-Aware Defaults: The quality slider is only shown for lossy formats (JPG, WEBP). Lossless formats (PNG, GIF, BMP) always use the best available compression path; the slider would be misleading on those.
- Response Headers: The API returns
X-Original-Size,X-Compressed-Size,X-Savings,X-Compress-Format,X-Compress-Quality, andX-Compress-Encoderso the client UI can render the savings comparison and so debugging tools can see which encoder was used. - Same-Format Output: No format conversion happens — what you upload is what you download
- Automatic Cleanup: Uploaded files are processed and discarded, not retained
Choosing the Right Quality
Quality 90-100
Visually lossless for most photos. JPG at 95 is what professional photo apps export by default. Use this range for archival work, prints, or anywhere quality is the priority over file size. The size reduction over the source is usually 20-40%.
Quality 75-85
The sweet spot for web. 75 is the tool's default. For most photos, a 75-quality JPG is visually indistinguishable from a 95-quality JPG at normal viewing distances, but it's 50-70% smaller. Use this range for CMS uploads, blog posts, and most user-facing imagery.
Quality 50-70
Aggressive compression with visible artifacts at high zoom. Use for thumbnails, previews, and anywhere the file size matters more than pixel-perfect fidelity. At 60, photos start to show blockiness in flat-color areas (sky, walls) and ringing around high-contrast edges.
Quality 1-50
Visible compression artifacts. Useful for email previews, tiny thumbnails, and "this image just needs to be on the page somewhere" use cases. Below 30, JPG quality degrades sharply.
Limitations
- This tool accepts JPG, PNG, WEBP, GIF, and BMP. HEIC, TIFF, and SVG are not accepted directly — to compress one of those, first run it through the Image Converter to flatten it to a raster format, then upload the result here.
- The quality slider only affects JPG and WEBP output. PNG, GIF, and BMP are always compressed with their best available path.
- For very small images (under a few KB) the re-encode can sometimes produce a slightly larger file. The result panel still shows the new size correctly, and the savings percent is clamped to 0 in that case.
- BMP has essentially no compression to apply. If you need a smaller file, convert the BMP to PNG first (via the Image Converter) and then compress.
- Compression only changes the file size — it does not change the pixel dimensions. To change the pixel dimensions, use the Image Resizer. To remove parts of the image, use the Image Cropper.
Remember: compression shrinks the file by changing how the pixels are encoded, not by removing pixels. For dimension changes use the Image Resizer, for region extraction use the Image Cropper, and for format conversion use the Image Converter.