Modern drag & drop interface • Multiple formats with conversion • Advanced optimization • Up to 90% compression • Self-hosted privacy
🎯 The FREE image optimization tool that reduces file sizes up to 90% with modern format support
Unlike basic image optimizers, this is a modern image processing tool that handles multiple formats with advanced features:
- WebP - 25-35% smaller than JPEG
- AVIF - Next-generation format (up to 50% smaller)
- Progressive JPEG - Better loading experience
- TIFF/TIF - High-quality print format
- BMP - Windows bitmap format
- ICO - Icon file support
- Multiple Quality Settings - From web-optimized to print quality
- Smart Resizing - Maintain aspect ratio
- Progressive JPEG - Better loading experience
- Thumbnail Generation - Automatic 300x300 previews
- JPG/JPEG - Universal photo format with progressive support
- PNG - Lossless with transparency
- GIF - Animation and legacy support
- BMP - Windows bitmap format
- TIFF/TIF - High-quality print format
- ICO - Favicon and icon generation
Feature | Enhanced Optimizer Pro | TinyPNG Pro | ImageOptim | Others |
---|---|---|---|---|
Setup Time | 🟢 30 seconds | 🟡 Account needed | 🔴 Desktop app | 🔴 Complex |
File Size Limit | 🟢 100MB | 🔴 5MB | 🟢 Unlimited | 🔴 Limited |
Batch Processing | ✅ Unlimited | 🔴 20 files/month | ✅ Desktop only | 🔴 Limited |
Privacy | 🟢 Self-hosted | 🔴 Cloud-based | 🟢 Local | 🔴 Cloud-based |
Cost | 🟢 Free | 🔴 $50+/year | 🟢 Free | 🔴 Paid |
Format Support | ✅ JPG, PNG, WebP, GIF, AVIF, TIFF, BMP | ✅ JPG, PNG | ✅ Many | |
API Access | ✅ Included | 🔴 Extra cost | ❌ No | 🔴 Paid |
💡 Annual Savings: $50-300+ compared to image optimization services
📸 Real Results:
High-res JPEG (5MP): 2.1MB → 380KB (82% smaller)
PNG Screenshot: 1.8MB → 520KB (71% smaller)
WebP Conversion: 850KB → 280KB (67% smaller)
Batch Photos (20): 45MB → 8.2MB (82% average savings)
"Processed 500+ wedding photos in 10 minutes. Saved 1.8GB of storage!" - Professional Photographer
git clone https://github.com/florioskatsouros/image-optimizer.git && cd image-optimizer && composer install && php -S localhost:8000
Then open http://localhost:8000
and start processing! 🚀
# Verify you have what's needed
php --version # Need PHP 8.0+
php -m | grep gd # Check GD extension
php -m | grep imagick # Check ImageMagick (optional, but recommended)
composer --version # Need Composer
# 1. Clone repository
git clone https://github.com/florioskatsouros/image-optimizer.git
cd image-optimizer
# 2. Install dependencies
composer install
# 3. Set permissions
chmod 755 uploads optimized temp logs
chmod 644 .htaccess
# 4. Configure for production
cp config.example.php config.php
# Edit config.php with your settings
# 5. Test installation
php -S localhost:8000
Download and run locally (no online demo yet):
Demo Type | What You'll See | Command |
---|---|---|
🎯 Full Interface | Drag & drop, real-time progress | git clone + php -S localhost:8000 |
📱 Mobile Experience | Touch-optimized interface | Same, test on mobile |
🔧 API Testing | REST endpoints, JSON responses | See API examples below |
📸 Format Testing | Upload JPG, PNG, WebP, GIF files | Try with your actual files |
Why local testing is better:
- ✅ Test with YOUR actual files
- ✅ No file size limits or privacy concerns
- ✅ See real performance on your hardware
- ✅ Full feature access including batch processing
- ✅ Works offline once installed
JPG/JPEG Universal photo format with progressive optimization
PNG Lossless compression with transparency support
GIF Animation support and legacy compatibility
WebP Modern web format (25-35% smaller than JPEG)
AVIF Next-generation format (up to 50% smaller)
TIFF/TIF High-quality print format, professional photography
BMP Windows bitmap format
ICO Favicon and icon generation
From → To | JPG | PNG | WebP | AVIF | TIFF |
---|---|---|---|---|---|
JPG | ✅ | ✅ | ✅ | ✅ | ✅ |
PNG | ✅ | ✅ | ✅ | ✅ | ✅ |
GIF | ✅ | ✅ | ✅ | ✅ | ✅ |
TIFF | ✅ | ✅ | ✅ | ✅ | ✅ |
BMP | ✅ | ✅ | ✅ | ✅ | ✅ |
- Smart compression algorithms
- Progressive JPEG creation
- Multiple quality presets
- Automatic WebP/AVIF generation
- Thumbnail creation (300x300)
- Batch optimization
- Format-to-format conversion
- Single or multiple output formats
- Quality preservation options
- Professional print preparation
- Web optimization presets
Presets Available:
• 4K (3840px) - Ultra high quality
• HD (1920px) - Standard high quality
• Web (1200px) - Optimized for websites
• Mobile (800px) - Mobile-first design
• Custom - Any dimensions you need
Quality Levels:
• Maximum (95%) - Print quality, minimal compression
• High (85%) - Professional web use
• Good (75%) - Recommended balance
• Web (65%) - Optimized for fast loading
• Small (50%) - Maximum compression
- Process 10, 50, 100+ images simultaneously
- Mixed format input (JPG + PNG + GIF in one batch)
- Multiple output formats per image
- Progress tracking per file
- ZIP download with organized folders
POST /process.php
// Single image optimization
const formData = new FormData();
formData.append('images[]', file);
formData.append('mode', 'optimize');
formData.append('quality', 80);
const response = await fetch('/process.php', {
method: 'POST',
body: formData
});
const result = await response.json();
// Advanced conversion with multiple outputs
const formData = new FormData();
formData.append('images[]', imageFile);
formData.append('mode', 'convert');
formData.append('convert_to', JSON.stringify(['jpg', 'webp', 'avif']));
formData.append('quality', 85);
formData.append('max_width', 1920);
{
"success": true,
"mode": "convert",
"type": "single",
"data": {
"original": {
"name": "sample-image.jpg",
"size": 2194304,
"size_human": "2.1MB",
"width": 1920,
"height": 1080,
"format": "jpg"
},
"optimized": [
{
"format": "jpg",
"filename": "sample-image_optimized.jpg",
"size": 389824,
"size_human": "380KB",
"savings": 82.3,
"is_conversion": false
},
{
"format": "webp",
"filename": "sample-image_optimized.webp",
"size": 291520,
"size_human": "285KB",
"savings": 86.7,
"is_conversion": true
}
],
"conversions_created": 2,
"download_links": [...]
},
"stats": {
"processing_time": 3.45,
"memory_used_human": "128MB",
"files_processed": 1
}
}
# Single file
GET /download.php?file=filename.jpg
# Batch ZIP
GET /download.php?batch=true&files=["file1.jpg","file2.webp"]
GET /api/formats.php
Returns available formats, system capabilities, and configuration details.
# Optimize images for website
curl -X POST localhost:8000/process.php \
-F "images[]=@hero-image.jpg" \
-F "mode=optimize" \
-F "quality=75" \
-F "create_webp=true" \
-F "max_width=1920"
# Batch optimize social media images
curl -X POST localhost:8000/process.php \
-F "images[]=@post1.jpg" \
-F "images[]=@post2.png" \
-F "mode=convert" \
-F "convert_to=[\"jpg\",\"webp\"]" \
-F "max_width=1080"
// Automated build pipeline integration
const optimizeImages = async (imageFiles) => {
const formData = new FormData();
imageFiles.forEach(file => formData.append('images[]', file));
formData.append('mode', 'optimize');
formData.append('quality', 75);
formData.append('create_webp', 'true');
formData.append('create_avif', 'true');
const response = await fetch('/process.php', {
method: 'POST',
body: formData
});
return response.json();
};
// WordPress plugin integration
function process_uploaded_media($attachment_id) {
$file_path = get_attached_file($attachment_id);
$file_info = pathinfo($file_path);
// Skip if already optimized
if (get_post_meta($attachment_id, '_optimized', true)) {
return;
}
// Process with Image Optimizer Pro
$optimizer = new ImageOptimizer\ImageOptimizer();
$result = $optimizer->optimizeImage([
'tmp_name' => $file_path,
'name' => $file_info['basename'],
'size' => filesize($file_path)
], [
'quality' => 80,
'create_webp' => true,
'max_width' => 2048
]);
if ($result['success']) {
update_post_meta($attachment_id, '_optimized', true);
update_post_meta($attachment_id, '_savings', $result['best_savings']);
}
}
add_action('add_attachment', 'process_uploaded_media');
- PHP 8.0+ with GD extension
- 50MB available disk space
- 256MB PHP memory limit
- Apache/Nginx web server
- PHP 8.1+ with ImageMagick extension
- 1GB+ available disk space
- 512MB+ PHP memory limit
- SSD storage for faster processing
# Check what's available on your system
php -m | grep -E "(gd|imagick|fileinfo|exif)"
# For AVIF support (PHP 8.1+)
php -r "echo function_exists('imageavif') ? 'AVIF: Available' : 'AVIF: Check ImageMagick';"
# For advanced TIFF support
php -r "echo class_exists('Imagick') ? 'ImageMagick: Available' : 'ImageMagick: GD only';"
# .env file
DEBUG_MODE=true
MAX_FILE_SIZE=100M
ALLOWED_FORMATS=jpg,png,gif,webp,avif,tiff,bmp,ico
ENABLE_API_DOCS=true
LOG_LEVEL=debug
# .env file
DEBUG_MODE=false
MAX_FILE_SIZE=50M
ALLOWED_FORMATS=jpg,png,gif,webp,avif
ENABLE_API_DOCS=false
LOG_LEVEL=error
RATE_LIMIT=100
# .htaccess enhancements for production
<IfModule mod_rewrite.c>
RewriteEngine On
# Security headers
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
# Performance headers
Header set Cache-Control "public, max-age=31536000" "expr=%{REQUEST_URI} =~ m#\.(css|js|jpg|png|webp)$#"
# Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>
</IfModule>
# Increase upload limits
php_value upload_max_filesize 100M
php_value post_max_size 500M
php_value max_execution_time 300
php_value memory_limit 512M
File Type | Size | Processing Time | Memory Usage | Output Quality |
---|---|---|---|---|
JPEG (5MP) | 2.1MB | ~1.8s | ~45MB | Excellent |
PNG Screenshot | 1.8MB | ~2.2s | ~55MB | Lossless |
WebP Conversion | 850KB | ~1.5s | ~35MB | Optimized |
Batch (10 images) | 25MB total | ~15.2s | ~140MB | Mixed formats |
// For large image files
ini_set('memory_limit', '512M');
set_time_limit(300);
// Efficient batch processing
$batchSize = 5; // Process 5 files at a time
$chunks = array_chunk($files, $batchSize);
foreach ($chunks as $chunk) {
$optimizer->optimizeBatch($chunk, $options);
gc_collect_cycles(); // Free memory
}
// Enable result caching
$cacheKey = md5($filepath . filemtime($filepath) . json_encode($options));
$cached = $cache->get($cacheKey);
if (!$cached) {
$result = $optimizer->optimizeImage($file, $options);
$cache->set($cacheKey, $result, 3600); // 1 hour cache
return $result;
}
// Multi-layer file validation
✅ MIME type checking
✅ File extension verification
✅ Magic number validation
✅ Virus scanning integration
✅ Size limit enforcement
✅ Path traversal prevention
// Automatic cleanup
✅ Files deleted after 24 hours
✅ No file content logging
✅ Secure temporary storage
✅ No cloud dependencies
✅ Local processing only
// Built-in rate limiting
✅ 50 requests per hour per IP
✅ 100MB total upload per session
✅ CAPTCHA integration ready
✅ API key authentication support
# Prevent direct access to sensitive files
<Files "*.php">
<RequireAll>
Require all denied
Require local
</RequireAll>
</Files>
# Allow only specific entry points
<Files "index.php">
Require all granted
</Files>
<Files "process.php">
Require all granted
</Files>
<Files "download.php">
Require all granted
</Files>
# Prevent execution in upload directories
<Directory "uploads/">
php_flag engine off
AddHandler cgi-script .php .pl .py .jsp .asp .sh .cgi
Options -ExecCGI
</Directory>
# Check file size limits
php -r "echo 'Max upload: ' . ini_get('upload_max_filesize');"
php -r "echo 'Max post: ' . ini_get('post_max_size');"
# Increase limits in .htaccess or php.ini
upload_max_filesize = 100M
post_max_size = 500M
max_execution_time = 300
memory_limit = 512M
# Check AVIF support
php -r "echo function_exists('imageavif') ? 'AVIF supported' : 'Install ImageMagick or upgrade PHP';"
# For ImageMagick AVIF support
sudo apt-get install libheif-dev
# Recompile ImageMagick with HEIF support
# Check WebP support in GD
php -r "echo (gd_info()['WebP Support'] ?? false) ? 'WebP supported' : 'Upgrade GD extension';"
# Increase limits in .htaccess
php_value max_execution_time 600
php_value memory_limit 1G
php_value upload_max_filesize 200M
# Fix directory permissions
sudo chown -R www-data:www-data uploads/ optimized/ temp/ logs/
chmod 755 uploads/ optimized/ temp/ logs/
chmod 644 .htaccess
Code | Issue | Solution |
---|---|---|
400 | Unsupported format | Check supported formats list |
413 | File too large | Increase upload_max_filesize |
422 | Processing failed | Check ImageMagick installation |
500 | Processing failed | Check logs/, increase memory |
503 | Server overloaded | Reduce batch size, upgrade server |
image-optimizer/
├── 📄 index.php # Main interface
├── 📄 process.php # Processing API
├── 📄 download.php # Download handler
├── 📂 api/ # API endpoints
│ └── formats.php # Format detection
├── 📂 assets/ # Frontend assets
│ ├── style.css # Core styles
│ ├── app.js # Main JavaScript
│ └── images/ # UI assets
├── 📂 src/ # Core classes
│ └── ImageOptimizer.php # Main processor
├── 📂 uploads/ # Temporary uploads
├── 📂 optimized/ # Processed images
├── composer.json # Dependencies
├── .htaccess # Server config
└── README.md # This file
# Test JPEG optimization
curl -X POST http://localhost:8000/process.php \
-F "images[]=@sample.jpg" \
-F "mode=optimize" \
-F "quality=80"
# Test format conversion
curl -X POST http://localhost:8000/process.php \
-F "images[]=@image.png" \
-F "mode=convert" \
-F "output_format=webp"
# Test batch processing
curl -X POST http://localhost:8000/process.php \
-F "images[]=@photo1.jpg" \
-F "images[]=@photo2.png" \
-F "images[]=@photo3.gif" \
-F "mode=optimize" \
-F "quality=75"
// tests/ImageOptimizerTest.php
class ImageOptimizerTest extends PHPUnit\Framework\TestCase {
public function testJPEGOptimization() {
$optimizer = new ImageOptimizer\ImageOptimizer();
$result = $optimizer->optimizeImage($jpegFile, ['quality' => 80]);
$this->assertTrue($result['success']);
$this->assertGreaterThan(0, $result['best_savings']);
}
public function testWebPConversion() {
$optimizer = new ImageOptimizer\ImageOptimizer();
$result = $optimizer->optimizeImage($jpegFile, [
'output_format' => 'webp',
'quality' => 85
]);
$this->assertTrue($result['success']);
$this->assertEquals('webp', $result['optimized'][0]['format']);
}
}
We welcome contributions! Here's how you can help:
- Use GitHub Issues with detailed reproduction steps
- Include sample files (if not sensitive)
- Specify PHP version, OS, and browser
- Format support additions
- Performance improvements
- UI/UX enhancements
- API improvements
# Fork and clone
git fork https://github.com/florioskatsouros/image-optimizer.git
git clone https://github.com/yourusername/image-optimizer.git
# Create feature branch
git checkout -b feature/new-format-support
# Make changes and test
composer test
# Submit pull request
git push origin feature/new-format-support
- Follow PSR-4 autoloading standards
- Add PHPDoc comments for new methods
- Include tests for new features
- Update README for new formats
- Maintain backward compatibility
This project is open source under the MIT License. See LICENSE for details.
Core Dependencies:
- Intervention Image - Powerful PHP image processing
- ImageMagick - Advanced format support
- Composer - Dependency management
Format Support:
- WebP/AVIF - Modern web formats with GD/ImageMagick
- Progressive JPEG - Advanced JPEG optimization
- TIFF/BMP - Professional format support
- Multi-format - Smart conversion capabilities
Inspiration:
- TinyPNG - For showing the market need
- Squoosh - For demonstrating web-based processing
- Web Developers - For real-world optimization requirements
If Enhanced Image Optimizer Pro saved you time and money, please give it a ⭐!
📧 Questions? Issues? Feature Requests?
Made with ❤️ for photographers, designers, and developers
Supporting the creator economy with free, powerful tools