TinyPixo is a modern web-based image optimization tool that enables users to compress and convert images to various formats while maintaining quality control. The application provides both single image and batch processing capabilities, supporting popular formats like WebP, AVIF, JPEG, and PNG.
The application leverages Next.js for server-side rendering and Sharp for high-performance image processing. It offers an intuitive user interface with real-time preview capabilities, detailed compression statistics, and flexible optimization settings. Users can adjust quality levels, resize images while maintaining aspect ratios, and process multiple images simultaneously with consistent settings.
Single image optimization interface showing before/after comparison with quality controls
Batch processing interface for optimizing multiple images simultaneously
.
├── app/ # Next.js application directory
│ ├── api/ # API routes for image processing
│ ├── globals.css # Global styles and custom slider components
│ ├── layout.tsx # Root layout component with metadata
│ └── page.tsx # Main application page component
├── components/ # React components
│ ├── BatchProcessor.tsx # Handles batch image processing
│ ├── ControlPanel.tsx # Image optimization controls
│ ├── ImageComparison.tsx # Side-by-side image comparison
│ └── ImageUpload.tsx # File upload handling
├── Dockerfile # Multi-stage Docker build configuration
├── next.config.js # Next.js configuration
└── package.json # Project dependencies and scripts
- Node.js 18 or later
- npm or yarn package manager
- Sharp image processing library
- Docker (optional, for containerized deployment)
# Clone the repository
git clone <repository-url>
cd tinypixo
# Install dependencies
npm install
# Start development server
npm run dev
# Build Docker image
docker build -t tinypixo .
# Run container
docker run -p 3000:3000 tinypixo
TinyPixo processes images dynamically through its web interface. Here's what you need to know about working with images in the application:
- Input: JPEG, PNG, WebP, AVIF
- Output: WebP, AVIF, JPEG, PNG
- Drag and drop files directly onto the upload area
- Click the upload area to select files using the system file picker
- Batch upload multiple images simultaneously
- Quality adjustment (1-100%)
- Format conversion
- Resize with aspect ratio preservation
- Batch processing with consistent settings
- Images are processed in-memory and not stored on the server
- Processed images must be downloaded after optimization
- Original images are only held in memory during processing
- Access the application at
http://localhost:3000
- Upload an image by dragging and dropping or clicking the upload area
- Select desired output format (WebP, AVIF, JPEG, or PNG)
- Adjust quality settings using the slider (1-100)
- Configure resize options if needed
- Download the optimized image
// Upload and optimize a single image
const handleImageUpload = async (file: File) => {
const formData = new FormData();
formData.append('image', file);
formData.append('format', 'webp');
formData.append('quality', '80');
const response = await fetch('/api/optimize', {
method: 'POST',
body: formData
});
const optimizedImage = await response.blob();
}
// Process multiple images with the same settings
const processBatch = async (files: File[]) => {
const settings = {
format: 'webp',
quality: 80,
width: 1920,
height: 1080
};
for (const file of files) {
// Process each file with the same settings
await processImage(file, settings);
}
};
- Image Upload Fails
# Check file size limits in next.config.js
export const config = {
api: {
bodyParser: {
sizeLimit: '10mb'
}
}
}
- Processing Error
- Ensure Sharp is properly installed
- Verify supported input formats
- Check server logs for detailed error messages
- Monitor memory usage during batch processing
- Use appropriate quality settings for different image types
- Consider implementing queue system for large batch operations
TinyPixo processes images through a streamlined pipeline that optimizes for both performance and quality.
[Client] -> [Upload] -> [Format Selection] -> [Quality Adjustment] -> [API Route] -> [Sharp Processing] -> [Optimized Image]
Component Interactions:
- Client uploads image(s) through ImageUpload component
- ControlPanel manages optimization settings
- BatchProcessor handles multiple file processing
- API route processes images using Sharp
- Optimized images are returned to client
- ImageComparison displays results
- Download functionality delivers processed images