Maximum image compression for optimal file sizes
A high-performance web application that compresses images to achieve the smallest possible file size while maintaining visual quality. Built with Next.js, Sharp, and TypeScript using advanced binary search algorithms and intelligent quality adjustment.
- 🎯 Maximum Compression: Targets the smallest possible file size (minimum 1KB) using intelligent algorithms
- 🖼️ Format Support: WebP and AVIF output with JPEG/PNG input
- ⚡ Adaptive Algorithms: Parallel processing with intelligent quality estimation
- 📐 Progressive Scaling: Dimension reduction when quality adjustment isn't sufficient
- 📊 Real-time Metrics: Processing time, compression ratio, and iteration tracking
- 🚀 PWA Support: Install as a Progressive Web App for offline use
- 💾 Smart Caching: Intelligent caching system for faster subsequent compressions
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm buildcurl -X POST http://localhost:3000/api/compress \
-F "[email protected]" \
-F "format=webp" \
-F "mode=balanced" \
--output compressed.webpimage: Input image file (JPEG, JPG, PNG)format: Output format (webporavif)mode: Compression mode (balancedorexact)
- 🔍 Binary Search: Quality values (1-100) with tolerance-based convergence
- ⚡ Parallel Processing: Multiple quality tests for faster optimization
- 🧠 Adaptive Heuristics: Image complexity analysis for better starting points
- 📏 Fallback Scaling: Dimension reduction for maximum compression
| Format | Processing Time | Compression Ratio | Quality Range |
|---|---|---|---|
| WebP | 100-300ms | 8-15:1 | 60-95% |
| AVIF | 200-500ms | 12-20:1 | 60-95% |
# Development commands
pnpm dev # Start development server
pnpm build # Production build
pnpm start # Production server
pnpm lint # Code linting- Quality Priority: Maintains visual quality with ±5KB tolerance
- Timeout: 90 seconds
- Use Case: General purpose compression
- Size Priority: Targets minimum possible file size
- Timeout: 90 seconds
- Use Case: Maximum compression when file size is critical
The compression behavior can be customized in src/lib/config.ts:
export const COMPRESSION_CONFIG: CompressionConfig = {
targetBytes: 1_000, // Minimum possible size (1KB)
toleranceBalanced: 5_000, // Balanced mode tolerance
toleranceExact: 0, // Exact mode tolerance
maxFileSize: 25 * 1024 * 1024, // 25MB max input
maxWallTimeBalanced: 20_000, // 20 seconds
maxWallTimeExact: 25_000, // 25 seconds
};- 📲 Installable: Add to home screen on mobile devices
- 🔄 Offline Support: Works without internet connection
- ⚡ Fast Loading: Optimized for performance
- 📊 Performance Dashboard: Real-time compression metrics
# Deploy to Vercel
vercel --prod# Build Docker image
docker build -t pixelpress .
# Run container
docker run -p 3000:3000 pixelpress- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with ❤️ using Next.js and Sharp
- Inspired by the need for maximum image compression
- Special thanks to the open-source community