Free and Open Source Image Compressor. Optimizes images locally, delivering unmatched efficiency without storing a single file. Experience lightning-fast compression, all in one place.
https://image-compressor.github.io
This project uses a modern, modular architecture with clear separation of concerns. The codebase is organized into focused components, custom hooks, and utility functions for optimal maintainability and testability.
βββ public/ # Static assets and PWA manifest
β βββ logo.png # Application logo variants
β βββ logo.svg # SVG logo files
β βββ manifest.json # PWA manifest configuration
β βββ fonts/ # Custom font files
βββ src/ # Frontend source code (React + TypeScript)
β βββ components/ # React components
β β βββ ui/ # Reusable UI components (shadcn/ui)
β β βββ action-buttons.tsx # Download/Reset functionality
β β βββ compressed-images-grid.tsx # Grid display for results
β β βββ drop-zone.tsx # File upload interface
β β βββ image-preview-card.tsx # Individual image preview
β β βββ image-quality-slider.tsx # Compression quality control
β β βββ loading-spinner.tsx # Loading states
β β βββ theme-provider.tsx # Dark/light theme support
β β βββ [other components]
β βββ hooks/ # Custom React hooks
β β βββ useDragAndDrop.ts # Drag & drop functionality
β β βββ useImageCompression.ts # Core compression logic
β βββ lib/ # Utility libraries
β β βββ utils.ts # Common utility functions
β βββ types/ # TypeScript type definitions
β β βββ image-compressor.ts # Core type interfaces
β βββ utils/ # Utility functions
β β βββ download.ts # File download utilities
β β βββ file-validation.ts # File type validation
β β βββ image-compression.ts # Image processing logic
β β βββ utils.ts # General utilities
β βββ App.tsx # Main application component
β βββ main.tsx # Application entry point
β βββ index.css # Global styles
βββ src-tauri/ # Tauri backend (Rust)
β βββ src/ # Rust source code
β β βββ lib.rs # Library functions
β β βββ main.rs # Application entry
β βββ icons/ # Application icons for platforms
β βββ capabilities/ # Tauri security capabilities
β βββ gen/ # Generated build files
β β βββ android/ # Android-specific build files
β βββ Cargo.toml # Rust dependencies
β βββ tauri.conf.json # Tauri configuration
β βββ build.rs # Build script
βββ package.json # Node.js dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite build configuration
βββ eslint.config.js # ESLint linting rules
βββ components.json # shadcn/ui components configuration
- Purpose: Main container that orchestrates the entire compression workflow
- Size: Optimized from ~410 lines to ~70 lines through modular design
- Responsibilities: Layout management, scroll behavior, component coordination
- Purpose: Handles file upload via drag & drop or file input
- Features: Visual drag feedback, file validation, multi-file support
- Integration: Works with
useDragAndDrophook and file validation utilities
- Purpose: Provides download and reset functionality
- Features: ZIP download, individual image download, state reset
- Platform Support: Tauri-compatible download handling
- Purpose: Displays compressed images in a responsive grid
- Features: Empty state handling, individual image actions, responsive layout
- Purpose: Core compression logic and state management
- State: Compressed images, ZIP files, loading states, progress tracking
- Methods:
handleImageUpload,onImageQualityChange,resetCompression
- Purpose: Drag and drop functionality management
- Features: Drag state tracking, event handling, file validation integration
- Exports:
ALLOWED_FORMATS,validateFileType,filterValidFiles - Purpose: Comprehensive file type validation and error handling
- Exports:
compressImage,processImages - Purpose: Core image processing with progress tracking
- Exports:
downloadZip,downloadSingleImage - Purpose: Cross-platform file download (Tauri & web compatible)
- Exports:
CompressedImage,ImageCompressorState - Purpose: Type-safe interfaces for all components and utilities
- π― Modular Architecture: Each component has a single responsibility
- π§ Type Safety: Full TypeScript integration with strict typing
- π± Cross-Platform: Tauri-based desktop app with web fallback
- π¨ Modern UI: shadcn/ui components with dark/light theme support
- β‘ Performance: Optimized compression with progress tracking
- π§ͺ Testable: Isolated components and utilities for easy testing
- π Reusable: Components can be used across different parts of the app
// Import individual components
import { ImageCompressor, DropZone, ActionButtons } from "./components";
import { useImageCompression, useDragAndDrop } from "./hooks";
import { validateFileType, downloadZip } from "./utils";
// Or import from main index
import {
ImageCompressor,
useImageCompression,
CompressedImage,
} from "./image-compressor";- Node.js version
20+andnpminstalled on your machine - For Tauri development: Rust toolchain installed
# Clone the repository
git clone https://github.com/abue-ammar/image-compressor.git
cd image-compressor
# Install dependencies
npm install
# Start development server
npm startOpen your browser and go to http://localhost:3000 to use the image compressor.
# Development
npm start # Start development server
npm run dev # Alternative development command
# Building
npm run build # Build for production
npm run preview # Preview production build
# Tauri (Desktop App)
npm run tauri dev # Start Tauri development
npm run tauri build # Build desktop application
# Code Quality
npm run lint # Run ESLint
npm run type-check # Run TypeScript compiler check- Frontend Development: Use
npm startfor hot-reload React development - Desktop App Development: Use
npm run tauri devfor Tauri development - Testing: Run individual component tests with the modular structure
- Building: Use
npm run buildfor web ornpm run tauri buildfor desktop
- Zero Dependencies for Core Functionality: No external image processing libraries
- Privacy First: All processing happens locally, no data leaves your device
- Cross-Platform: Runs in browsers and as a desktop application
- Modern Stack: React 18, TypeScript, Vite, Tauri, shadcn/ui
- Optimized Performance: Efficient compression algorithms with progress tracking
- πΌοΈ Multi-Format Support: JPEG, PNG, WebP, and more
- ποΈ Quality Control: Adjustable compression levels with live preview
- π¦ Batch Processing: Compress multiple images simultaneously
- πΎ Flexible Downloads: Download individual images or ZIP archives
- π±οΈ Drag & Drop: Intuitive file upload interface
- π± Responsive Design: Works on desktop and mobile devices
- π Dark/Light Theme: Automatic theme switching support
- π Privacy Focused: All processing happens locally in your browser
- β‘ Fast Performance: Optimized compression algorithms
- π₯οΈ Desktop App: Available as a native desktop application via Tauri
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Install dependencies:
npm install - Start development:
npm start - Make your changes
- Test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Use the existing component structure
- Maintain the modular architecture
- Add proper type definitions
- Write meaningful commit messages
- Test components in isolation
- Verify cross-platform compatibility (web + Tauri)
- Test with various image formats and sizes
- Ensure accessibility standards are met
- New image formats support
- Performance optimizations
- UI/UX improvements
- Mobile responsiveness
- Accessibility enhancements
- Documentation improvements
This project is licensed under the MIT License - see the LICENSE file for details.