Compress Image
Advanced Image Compression API for Web Performance Optimization
Transform your website’s performance with our powerful Image Compression API that reduces file sizes by up to 90% while maintaining visual quality. Perfect for developers building fast-loading websites, mobile apps, and content management systems.
Key Features & Benefits
- Precise File Size Control - Compress images to exact target sizes (50kb, 100kb, 200kb, 500kb, 1mb, 2mb)
- Multi-Format Support - Optimize JPG, PNG, and WebP images with advanced algorithms
- Flexible Compression Levels - Choose from Max, Medium, or Low compression based on your quality requirements
- Bulk Processing - Handle thousands of images efficiently with our scalable API
- SEO Performance Boost - Improve Core Web Vitals scores and Google rankings
- Cost Savings - Reduce bandwidth costs and storage expenses significantly
Perfect for Modern Web Development
Ideal for React, Next.js, Angular, Vue.js, WordPress, Drupal, Joomla, React Native, Flutter, iOS, and Android applications. Whether you’re building e-commerce platforms, blog systems, or mobile apps, our API ensures your images load lightning-fast across all devices.
Performance Impact
- 70% faster page load times - Dramatically improve user experience
- 90% file size reduction - Maximize storage efficiency
- Better SEO rankings - Google rewards fast-loading websites
- Reduced bounce rates - Keep users engaged with quick-loading content
- Lower hosting costs - Minimize bandwidth and CDN expenses
API Endpoint Details
Method:POST
Endpoint:/api/v2/CompressImage
Content-Type:application/json
Authentication: Required (API Key)
Quick Start
- Get your API key from the PDF4me Dashboard
- Include authentication in your request headers
- Send image data as base64 encoded content
- Receive compressed image with optimized file size
Authenticating Your API Request
To access the PDF4me Web API, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user.
Why Use Image Compression?
Image compression is essential for:
- Faster website loading times - Reduce page load speed by up to 70%
- Improved SEO rankings - Google prioritizes fast-loading websites
- Reduced bandwidth costs - Lower data transfer expenses
- Better user experience - Faster image loading across all devices
- Storage optimization - Save up to 90% storage space
Supported Image Formats
Our API supports compression for:
- JPG/JPEG - Best for photographs and complex images
- PNG - Ideal for graphics with transparency
- WebP - Modern format with superior compression
Compression Levels Explained
- Max Compression - Maximum file size reduction (up to 90% smaller)
- Medium Compression - Balanced quality and size (60-70% reduction)
- Low Compression - Minimal quality loss (30-40% reduction)
Parameters
Request Parameters
Configure your image compression with these powerful parameters. Each parameter is designed to give you precise control over the compression process while maintaining optimal image quality for your specific use case.
Parameter Overview
| Parameter | Type | Required | Description |
|---|---|---|---|
| File Name | String | Yes | Original image filename with extension |
| File Content | Base64 | Yes | Image data encoded in base64 format |
| Image Type | String | Yes | Output format (JPG, PNG, WebP) |
| Compression Level | String | Yes | Compression intensity (Max, Medium, Low) |
Pro Tips for Better Results
- Use descriptive filenames for better organization
- Choose appropriate image type based on your use case
- Select compression level based on quality requirements
- Optimize base64 encoding for faster processing
- File NameString, Required
Original image filename with proper extension (e.g.,
photo.jpg,logo.png,banner.webp). This helps identify the source format and ensures proper processing. Use descriptive names for better organization and debugging.Examples:
product-image-001.jpgcompany-logo.pnghero-banner.webp
Best Practices:
- Include descriptive keywords in filename
- Use consistent naming conventions
- Avoid special characters and spaces
- File Contentbase64, Required
Base64 encoded image data containing the actual image content. This is the binary image data converted to a text string for API transmission.
Supported Formats:
- JPG/JPEG - Best for photographs and complex images
- PNG - Ideal for graphics with transparency
- WebP - Modern format with superior compression
Size Limits:
- Maximum file size: 50MB
- Recommended: Under 10MB for optimal performance
Encoding Tips:
- Use proper base64 encoding without data URL prefix
- Ensure no line breaks or whitespace in encoded string
- Validate encoding before sending to API
- Image TypeString, Required
Select the output image format for your compressed image. Choose the format that best suits your use case and performance requirements.
Supported Formats
Format Best For File Size Quality SEO Impact JPG Photos, complex images Smallest Good High PNG Graphics, logos, transparency Medium Excellent Medium WebP Modern web images Smallest Excellent High Format Selection Guide
- JPG: Use for photographs, product images, and complex visuals
- PNG: Choose for logos, graphics with transparency, and simple designs
- WebP: Best for modern web applications with excellent compression
SEO Benefits
- WebP: 25-35% smaller than JPG, faster loading
- JPG: Universal compatibility, great for e-commerce
- PNG: Perfect for logos and graphics that need transparency
- CompressionLevelString, Required
Choose the compression intensity level that balances file size reduction with image quality. Each level is optimized for different use cases and performance requirements.
Compression Levels
Level File Size Reduction Quality Best For SEO Impact Max 80-90% Good Web thumbnails, social media High Medium 60-70% Very Good Blog images, product photos Medium Low 30-40% Excellent Print quality, detailed images Low Selection Guidelines
- Max: Use for thumbnails, social media, and when file size is critical
- Medium: Perfect for most web applications and e-commerce
- Low: Choose when image quality is paramount
Performance Impact
- Max: Fastest loading, best for mobile
- Medium: Balanced performance and quality
- Low: Highest quality, larger files
Output
- File ContentBinary, Required
File content of the compressed document
- File NameString, Required
The file name of the output document
Use Cases and Applications
Perfect for:
- E-commerce websites - Optimize product images for faster loading
- Blog platforms - Compress images for better SEO performance
- Content management systems - WordPress, Drupal, Joomla integration
- Mobile app development - React Native, Flutter, iOS, Android
- Web frameworks - React, Next.js, Angular, Vue.js applications
- Bulk image processing - Process thousands of images efficiently
- Social media optimization - Compress images for Instagram, Facebook, Twitter
- Email marketing - Optimize images for newsletters and campaigns
File Size Optimization Examples
- Compress image to 50kb - Perfect for thumbnails and small previews
- Compress image to 100kb - Ideal for mobile-optimized images
- Compress image to 200kb - Great for blog post featured images
- Compress image to 500kb - Suitable for product gallery images
- Compress image to 1mb - Perfect for high-quality web images
- Compress image to 2mb - Maximum size for detailed product photos
Performance Benefits
- Up to 90% file size reduction - Dramatically reduce storage costs
- 70% faster page load times - Improve Core Web Vitals scores
- Better SEO rankings - Google rewards fast-loading websites
- Reduced bandwidth usage - Lower hosting and CDN costs
- Improved user experience - Faster image loading on all devices
Header
Content-Type:application/json
Authorization: Please copy key from the link.
Payload
{
"docContent": "Please put image base64 content",
"docName": "stamp.jpg",
"imageType": "JPG",
"compressionLevel": "Low"
}
PDF4me api samples
- CSharp(C#)
- Java
- JavaScript
- Python
- Salesforce
- n8n
- Google Script
- AWS Lambda