Skip to content

Commit c9648a4

Browse files
authored
Merge pull request #1 from BaseMax/copilot/convert-image-formats
Implement ImageFormatLab: Client-side image format converter with visual comparison
2 parents 7567e19 + 01172b8 commit c9648a4

3 files changed

Lines changed: 1021 additions & 0 deletions

File tree

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build outputs
8+
dist/
9+
build/
10+
*.min.js
11+
*.min.css
12+
13+
# IDE and editor files
14+
.vscode/
15+
.idea/
16+
*.swp
17+
*.swo
18+
*~
19+
.DS_Store
20+
21+
# OS files
22+
Thumbs.db
23+
desktop.ini
24+
25+
# Temporary files
26+
tmp/
27+
temp/
28+
*.tmp
29+
*.log
30+
31+
# Environment files
32+
.env
33+
.env.local
34+
.env.*.local

README.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,152 @@
11
# ImageFormatLab
2+
23
Image Format Lab is a client-side web tool that converts a single image into multiple modern image formats and presents a clear, visual comparison of quality, size, and compression efficiency. All processing happens directly in the browser.
4+
5+
## 🚀 Features
6+
7+
### Core Functionality
8+
- **Multiple Format Conversion**: Converts images to PNG, JPEG, WebP, and AVIF (where supported)
9+
- **Canvas-Based Re-encoding**: Uses HTML5 Canvas API for accurate image conversion
10+
- **Quality Control**: Adjustable quality slider for JPEG and WebP formats (1-100%)
11+
- **Drag & Drop Interface**: Easy file upload with drag-and-drop support
12+
13+
### Visual Comparison Tools
14+
- **File Size Display**: Shows compressed size for each format with original file size reference
15+
- **Compression Ratio**: Calculates and displays compression efficiency for each format
16+
- **Side-by-Side Preview**: View all formats simultaneously with zoomable previews
17+
- **Pixel-Difference Heatmap**: Advanced view showing visual differences from original (optional)
18+
19+
### Output Options
20+
- **Download Converted Images**: Save any converted format directly to your device
21+
- **Format Recommendations**: Educational information about each format's best use cases
22+
23+
## 🎯 Why Use ImageFormatLab?
24+
25+
- **Helps developers and designers choose optimal formats** for web projects
26+
- **Educational tool** to understand format differences and compression trade-offs
27+
- **Practical utility** for quick image format conversion and comparison
28+
- **Privacy-focused**: All processing happens client-side, no server uploads
29+
30+
## 🖼️ Supported Formats
31+
32+
### Input Formats
33+
- JPEG/JPG
34+
- PNG
35+
- GIF
36+
- BMP
37+
- WebP
38+
39+
### Output Formats
40+
- **PNG**: Lossless compression, best for graphics with transparency
41+
- **JPEG**: Universal support, ideal for photographs
42+
- **WebP**: Modern format with excellent compression and quality balance
43+
- **AVIF**: Next-generation format with superior compression (browser support required)
44+
45+
## 🔧 How to Use
46+
47+
1. **Open the Application**: Open `index.html` in a modern web browser
48+
2. **Upload an Image**:
49+
- Click the upload area to browse for a file
50+
- Or drag and drop an image directly onto the upload area
51+
3. **Adjust Quality** (optional): Use the slider to set JPEG/WebP quality (default: 85%)
52+
4. **Enable Heatmap** (optional): Check the box to see pixel differences
53+
5. **Convert**: Click "Convert Image" button
54+
6. **Review Results**:
55+
- Compare file sizes and compression ratios
56+
- View side-by-side previews (click to zoom)
57+
- Analyze pixel-difference heatmaps (if enabled)
58+
7. **Download**: Save any converted format using the download buttons
59+
60+
## 📊 Understanding the Results
61+
62+
### File Size
63+
The size of the converted file in KB or MB. Smaller files load faster on web pages but may have lower quality.
64+
65+
### Size Reduction
66+
Percentage showing how much smaller (or larger) the converted file is compared to the original.
67+
68+
### Compression Ratio
69+
Ratio of original size to compressed size. Higher values indicate better compression:
70+
- `> 1.0x`: File was compressed (good)
71+
- `< 1.0x`: File became larger (may indicate original was already optimized)
72+
73+
### Pixel-Difference Heatmap
74+
Visual representation of quality loss:
75+
- **Black areas**: No difference from original
76+
- **Red areas**: Visible differences detected
77+
- **Brighter red**: Greater pixel differences
78+
79+
## 🌐 Browser Compatibility
80+
81+
- **Chrome/Edge**: Full support (PNG, JPEG, WebP, AVIF)
82+
- **Firefox**: Full support (PNG, JPEG, WebP, AVIF)
83+
- **Safari**: PNG, JPEG, WebP supported; AVIF support varies by version
84+
- **Requires**: Modern browser with Canvas API and Blob support
85+
86+
## 💡 Format Selection Guide
87+
88+
### When to Use Each Format
89+
90+
**PNG**
91+
- Images requiring transparency
92+
- Graphics, logos, and illustrations
93+
- When lossless quality is essential
94+
- Screenshots and UI elements
95+
96+
**JPEG**
97+
- Photographs and complex images
98+
- When some quality loss is acceptable
99+
- Maximum compatibility needed
100+
- File size is a concern
101+
102+
**WebP**
103+
- Modern web applications
104+
- Balance of quality and file size
105+
- When browser support allows
106+
- Both photos and graphics
107+
108+
**AVIF**
109+
- Cutting-edge web projects
110+
- Maximum compression needed
111+
- When browser compatibility is not critical
112+
- Future-proof web applications
113+
114+
## 🚀 Quick Start
115+
116+
Simply open the `index.html` file in your browser:
117+
118+
```bash
119+
# Using Python
120+
python3 -m http.server 8080
121+
122+
# Using Node.js
123+
npx serve
124+
125+
# Using PHP
126+
php -S localhost:8080
127+
```
128+
129+
Then navigate to `http://localhost:8080` in your browser.
130+
131+
## 📝 Technical Details
132+
133+
- **Pure HTML/CSS/JavaScript**: No dependencies or build process required
134+
- **Client-Side Processing**: All conversions happen in your browser
135+
- **Privacy-Focused**: Images never leave your device
136+
- **Responsive Design**: Works on desktop and mobile devices
137+
138+
## 🤝 Contributing
139+
140+
Contributions are welcome! This project is open-source and available for improvements.
141+
142+
## 📄 License
143+
144+
See LICENSE file for details.
145+
146+
## 🎨 Screenshots
147+
148+
### Initial Upload Screen
149+
Upload interface with drag-and-drop support.
150+
151+
### Conversion Results
152+
Format comparison showing file sizes, compression ratios, side-by-side previews, and optional pixel-difference heatmaps.

0 commit comments

Comments
 (0)