A TypeScript-based web application for splitting, compressing, and resizing images with an intuitive drag & drop interface. Features Smart Crop functionality for intelligent content centering and advanced layer-based editing capabilities.
- Install dependencies:
npm install
- Build the application:
npm run build
- Start the server:
npm start
- Open your browser:
Go to:
http://localhost:3000
Development mode (with hot reload):
npm run dev
- Image Splitting: Split square images into 4 equal parts
- Compression: PNG compression (adjustable quality 50-100%, default: 100%)
- Resizing: Scale images to any target size
- Aspect Ratio Crop: Crop images to specific aspect ratios with interactive preview
- Preset Ratios: 16:9, 16:10, 4:3, 1:1, 9:16, 3:4 + Custom ratios
- Multi-Image Preview: Live canvas preview with individual crop positioning
- Interactive Drag & Drop: Adjust crop position per image with visual feedback
- Crop Overlay: Visual crop area with red border and corner handles
- Auto-Trim: Automatically remove transparent areas
- Configurable minimal padding (0-50px, default: 2px)
- Adjustable detection tolerance (5-100, default: 100)
- Fixed Target Size after Auto-Trim: Scale trimmed images to exact dimensions while preserving proportions
- Smart Crop: Intelligent content detection with configurable padding (uniform or individual sides)
- Batch Processing: Process up to 20 images simultaneously
- Transparency Preservation: PNG transparency is maintained throughout all operations
- Intelligent Naming: Prefix + sequential numbering with collision avoidance
- 3-Layer System: Position up to 3 images as layers on top of each other
- Live Preview: Real-time canvas rendering with red alignment guide (50% opacity)
- Layer Controls:
- Visibility toggle
- Scaling (0.1x - 3.0x in 0.05 increments)
- X/Y Position (-200px to +200px)
- Preset System: Save and load layer configurations (localStorage)
- Guide Size: Adjustable alignment guide (50-300px)
- Export Options:
- Output sizes: 128x128, 256x256, 512x512, 1024x1024
- Adjustable compression quality (50-100%)
- Auto-Scaling: Images automatically scale to fit output size when loaded
- Reference-based Color Correction: Match images to a reference image's color characteristics
- Live Preview: 3-canvas system (Original, Reference, Adjusted) with real-time updates
- Advanced Color Controls:
- Intensity (0-300%): Strength of color matching
- Saturation (0-300%): Color vibrancy
- Brightness (30-200%): Overall brightness
- Contrast (50-200%): Difference between light and dark areas
- Hue Shift (-180° to +180°): Color spectrum rotation
- Sharpness (0-300%): Image sharpness and detail
- Noise Reduction (0-100%): Smoothing of image artifacts
- Gamma Correction (0.5-2.0): Tone curve adjustment
- Batch Processing: Process multiple images with consistent reference matching
- Debounced Preview: Performance-optimized preview with 500ms delay
- Reset Function: Reset all settings to default values
# Clone the repository
git clone https://github.com/loonylabs-dev/img-bulk-tool.git
cd img-bulk-tool
# Install dependencies
npm install
# Build the application
npm run build
# Start the production server
npm start
- Upload Images: Drag & drop or file selection (max. 20 images)
- Select Mode:
- Split: Divide image into 4 quadrants
- Resize: Scale to desired dimensions
- Compress Only: Reduce file size without resizing
- Split + Resize: Combine both operations
- Aspect Ratio Crop: Crop to specific aspect ratios with interactive positioning
- Configure Options:
- Set quality (50-100%, default: 100%)
- Enable Auto-Trim for automatic transparent area removal
- Optional: "Fixed Target Size after Auto-Trim" for exact dimensions (e.g., 512x512)
- Works in all modes (Compress, Split, etc.)
- Enable Smart Crop for intelligent content detection
- Define prefix for output files
- Click "Process Images"
- Download individual files or all at once
- Upload up to 3 images as layers (drag & drop or click)
- Adjust layers individually:
- Toggle visibility
- Fine-tune scaling (0.05 increments)
- Adjust position (X/Y axis)
- Guide settings:
- Show/hide red alignment guide
- Adjust guide size (slider or number input)
- Use presets:
- Save/load configurations
- Pre-installed example setup available
- Export settings:
- Choose output size (128x128 to 1024x1024)
- Set compression quality
- Enter filename prefix
- Click "Export Layers"
- Upload Reference Image: First image to define target color characteristics
- Preview is automatically displayed
- Add Target Images: Images to be adjusted
- Batch upload of multiple images supported
- Individual images can be removed
- Use Live Preview:
- 3-canvas view: Original, Reference, Adjusted
- Preview updates automatically with changes
- Adjust Color Controls:
- Basic Settings: Intensity and Quality
- Advanced Controls: Saturation, Brightness, Contrast
- Special Effects: Hue Shift, Sharpness, Noise Reduction
- Tone: Gamma Correction for fine adjustments
- Reset Option: Reset all settings to defaults
- Start Processing: Click "🎨 Start Color Matching"
- Download Results: Individual files or all at once
- Upload Images: Drag & drop or file selection (max. 20 images)
- Select Aspect Ratio Crop Mode: Choose "🎯 Aspect Ratio Crop" option
- Choose Aspect Ratio:
- Preset Options: 16:9 (Widescreen), 16:10 (Monitor), 4:3 (Classic), 1:1 (Square), 9:16 (Portrait), 3:4 (Portrait Classic)
- Custom Ratio: Define your own width:height ratio
- Interactive Crop Preview:
- Multi-Image Grid: See all uploaded images with crop overlays
- Visual Feedback: Red crop borders with corner handles
- Drag to Position: Click and drag within crop areas to adjust positioning per image
- Live Updates: Instant preview of crop changes
- Configure Quality: Set compression level (50-100%)
- Add Filename Prefix: Optional prefix for output files
- Process Images: Click "Process Images" to apply crops
- Download Results: Individual cropped images or batch download
- server.ts: Express server with REST API and static file serving
- lib/imageProcessor.ts: Core image operations (split, resize, Smart Crop with pixel-level analysis)
- lib/compressor.ts: PNG compression using imagemin + pngquant + optipng
- lib/fileManager.ts: File naming with collision avoidance and sequential numbering
- lib/colorAnalyzer.ts: Advanced color analysis and matching engine
- index.html: Single-page app with drag & drop interface
- js/main.ts: Application entry point with modular architecture
- js/components/: Reusable UI components (BaseComponent, TabComponent)
- js/features/: Feature modules (BulkProcessor, LayerEditor, ColorMatcher)
- js/services/: Business logic layer (ApiService, FileService)
- css/: Responsive styling with grid layouts
- Frontend uploads files via FormData to
/api/process
(bulk processing with aspect-crop support),/api/layer-process
, or/api/color-match
- Backend processes images based on mode-specific logic (
split
,resize
,compress
,split-resize
,aspect-crop
) - For aspect-crop mode: Individual crop positions and aspect ratio parameters sent with request
- Files saved to
output/
with collision-safe naming:[prefix]_[number].png
- Results returned with download URLs and file metadata
Output files are named as: [prefix]_[number].png
- Sequential numbering starts from 1
- Automatic collision avoidance by incrementing
- No additional identifiers
Examples:
- 1 image split (prefix: "icon"):
icon_1.png
,icon_2.png
,icon_3.png
,icon_4.png
- 3 images compressed (prefix: "asset"):
asset_1.png
,asset_2.png
,asset_3.png
npm run dev
: Development mode (Backend + Frontend watch)npm run build
: Full build (Backend + Frontend)npm run build:backend
: Compile backend onlynpm run build:frontend
: Compile frontend onlynpm start
: Start production server (requires build)npm run serve
: Preview built frontendnpm run type-check
: TypeScript type checking without build
- Backend: Node.js + Express + TypeScript
- Frontend: Modular TypeScript + Vite + ES2022 Modules
- Architecture: Event-driven, component-based, Service Layer Pattern
- Image Processing: Sharp.js (fast and precise)
- Compression: imagemin + pngquant + optipng
- Upload: Multer for file processing
- TypeScript: Strict mode, full type safety
Perfect for creating consistent dimensions:
- Icons: 512x512 app icons with consistent dimensions
- Sprites: Uniform sprite sizes for game development
- Thumbnails: Consistent preview images for galleries
- Asset Libraries: Standardized image sizes for design systems
- Product Photography: Uniform look for e-commerce catalogs
- Portfolio Optimization: Harmonious color mood in image galleries
- Social Media: Consistent branding across multiple posts
- Creative Effects: Vintage looks, film aesthetics, artistic color combinations
Performance: Utilizes Sharp for ultra-fast image processing, progressive compression with imagemin + pngquant, and Vite for optimized frontend builds.