What is Auto Compression?
Auto compression automatically reduces image file sizes during upload while maintaining visual quality. This saves storage space and makes images load faster for your users.Compression is optional and can be configured in your Dashboard Settings.
How It Works
When you upload an image with auto-compression enabled:1
Upload Detection
Imperial receives your image and detects its format (JPEG, PNG, WebP)
2
Quality Analysis
The image is analyzed to determine the optimal compression settings
3
Smart Compression
Using Sharp (high-performance image processing), the image is recompressed with your quality setting
4
Size Verification
If compression makes the file larger (rare), the original is kept instead
5
Storage & Delivery
The optimized image is stored and delivered via CDN
Supported Formats
- JPEG
- PNG
- WebP
Best for: Photos, complex images with gradients
- Default quality: 80%
- Typical savings: 40-60%
- Maintains color accuracy
- Uses optimized encoding (Progressive JPEG)
Quality Settings
You can customize the compression quality in your dashboard:| Quality | File Size | Visual Quality | Best For |
|---|---|---|---|
| 60% | Smallest | Noticeable loss | Thumbnails, previews |
| 70% | Very Small | Slight loss | Web images, social media |
| 80% | Balanced | Minimal loss | Default, recommended |
| 90% | Larger | Nearly perfect | Professional photography |
| 100% | Largest | Perfect | Original archival |
Technical Implementation
Imperial uses Sharp, the industry-standard high-performance image processing library:Why Sharp?
Fast Processing
4-5x faster than ImageMagickUses libvips for efficient memory usage
High Quality
Professional-grade algorithmsMaintains color profiles and metadata
Memory Efficient
Streams data instead of loading full imagesCan process images larger than RAM
Modern Formats
Supports WebP, AVIF, JPEG XLFuture-proof for new formats
Compression Algorithm
Real-World Examples
Example 1: Product Photos
Example 2: Screenshots
Example 3: Web Graphics
When to Use Compression
✅ Great For
✅ Great For
- Web Images: Photos, banners, backgrounds
- Social Media: Posts, stories, profile pictures
- App Assets: Icons, splash screens, UI elements
- User Uploads: Profile pictures, content submissions
- Large Galleries: Photo albums, portfolios
❌ Skip Compression For
❌ Skip Compression For
- Print Materials: Need maximum quality
- Professional Photography: Client deliverables
- Medical/Scientific: Requires perfect accuracy
- Already Optimized: Files that are already small
- Videos: Use dedicated video encoders instead
Storage Savings Calculator
Per-Image Savings
Cost Savings
With Imperial’s pricing:Performance Impact
Upload Processing Time
Compression adds minimal overhead:| Image Size | Without Compression | With Compression | Overhead |
|---|---|---|---|
| 1 MB | 200ms | 250ms | +50ms |
| 5 MB | 800ms | 950ms | +150ms |
| 10 MB | 1,500ms | 1,800ms | +300ms |
The slight processing delay is offset by faster uploads to R2 (smaller files) and faster CDN delivery to users.
Configuration
Enable compression in your dashboard:1
Navigate to Settings
Go to Dashboard Settings → Uploads
2
Enable Auto-Compress
Toggle “Auto-compress images” on
3
Set Quality
Choose your quality level (60-100%)Recommended: 80%
4
Save Changes
Your preference applies to all future uploads
API Usage
Compression settings are account-level and apply automatically to API uploads:Quality Comparison
Visual Examples
- 100% Quality
- 90% Quality
- 80% Quality ⭐
- 70% Quality
- 60% Quality
- File Size: 2.4 MB
- Quality: Perfect, original
- Use Case: Archival, print
Advanced Features
Progressive JPEG
All compressed JPEGs use progressive encoding:Metadata Preservation
Imperial preserves important metadata:- EXIF: Camera info, date taken (optional)
- Color Profile: sRGB, Display P3
- Orientation: Proper rotation
- GPS Data: For privacy
- Thumbnail: Redundant, increases size
Disable Compression
Need original quality? Simply disable compression in settings:Get Started
Try compression and see the savings:Upload and Compare
Upload an image to see compression in action

