|
1 |
| -# js-webp-convertor |
2 |
| -Converts locale pictures to Webp in vanilla Javascript - no server needed |
| 1 | +# WebP Image Converter |
| 2 | + |
| 3 | +[](https://opensource.org/licenses/MIT) |
| 4 | + |
| 5 | +A modern, client-side web application that converts various image formats to WebP with no server required. Optimize your images directly in the browser to save space and improve website loading times. |
| 6 | + |
| 7 | +## 🌟 Features |
| 8 | + |
| 9 | +- **100% Client-Side Processing**: All conversion happens in your browser - no data is sent to any server |
| 10 | +- **Multiple Format Support**: Convert JPG, PNG, GIF, TIFF, BMP, AVIF and even existing WebP files |
| 11 | +- **Batch Processing**: Convert multiple images at once |
| 12 | +- **Adjustable Quality**: Fine-tune compression with a quality slider (1-100%) |
| 13 | +- **Resize Option**: Optionally resize images to specific maximum dimensions |
| 14 | +- **Comparison View**: See before/after results with file size reduction stats |
| 15 | +- **Batch Download**: Download all converted images as a single ZIP file |
| 16 | +- **Multilingual**: Supports 13 languages with auto-detection: |
| 17 | + - English, French, Spanish, Portuguese, German, Italian |
| 18 | + - Polish, Russian, Ukrainian, Chinese, Thai |
| 19 | + - Right-to-left languages: Arabic and Hebrew |
| 20 | +- **Responsive Design**: Works on any device from mobile to desktop |
| 21 | +- **Dark/Light Mode**: Automatic theme based on system preference with toggle |
| 22 | + |
| 23 | +## 🖥️ Live Demo |
| 24 | + |
| 25 | +Try it now: [WebP Image Converter](https://l3dlp.github.io/js-webp-convertor/) |
| 26 | + |
| 27 | +## 📋 How It Works |
| 28 | + |
| 29 | +1. **Upload Images**: Drag & drop or select image files |
| 30 | +2. **Configure Settings**: |
| 31 | + - Adjust quality (higher = better image quality but larger file size) |
| 32 | + - Optionally enable resizing with custom dimensions |
| 33 | +3. **Convert**: Process all images with a single click |
| 34 | +4. **Review Results**: See comparison between original and WebP versions |
| 35 | +5. **Download**: Get individual files or all images as a ZIP |
| 36 | + |
| 37 | +## ⚙️ Technical Details |
| 38 | + |
| 39 | +- Built with vanilla JavaScript - no frameworks or libraries for core functionality |
| 40 | +- Uses Canvas API and `toBlob()` for WebP conversion |
| 41 | +- Browser-image-compression library for initial optimization |
| 42 | +- JSZip for batch downloads |
| 43 | +- Tailwind CSS for styling with a clean Apple-inspired design |
| 44 | +- Font Awesome for icons |
| 45 | +- Supports all modern browsers with WebP capabilities |
| 46 | + |
| 47 | +## 🚀 Getting Started |
| 48 | + |
| 49 | +### Local Development |
| 50 | + |
| 51 | +1. Clone the repository: |
| 52 | + ```bash |
| 53 | + git clone https://github.com/l3dlp/js-webp-convertor.git |
| 54 | + cd js-webp-convertor |
| 55 | + ``` |
| 56 | + |
| 57 | +2. Serve with any static file server: |
| 58 | + ```bash |
| 59 | + # Using Node.js serve (install with: npm install -g serve) |
| 60 | + npx serve |
| 61 | + |
| 62 | + # Or Python's built-in HTTP server |
| 63 | + python -m http.server |
| 64 | + ``` |
| 65 | + |
| 66 | +3. Open your browser and navigate to `http://localhost:5000` (or whatever port your server uses) |
| 67 | + |
| 68 | +### Integration |
| 69 | + |
| 70 | +To integrate the converter into your own website: |
| 71 | + |
| 72 | +1. Copy the `src` directory to your project |
| 73 | +2. Include the necessary scripts and styles |
| 74 | +3. Customize as needed (see the [Customization](#customization) section) |
| 75 | + |
| 76 | +## 🔧 Customization |
| 77 | + |
| 78 | +You can modify the application by: |
| 79 | + |
| 80 | +- Editing the `main.css` file to change styles |
| 81 | +- Adding more languages to `translations.json` |
| 82 | +- Modifying quality defaults in the JavaScript |
| 83 | +- Changing supported file types |
| 84 | + |
| 85 | +## 🌐 Browser Compatibility |
| 86 | + |
| 87 | +Works in all modern browsers that support the WebP format and the Canvas API: |
| 88 | +- Chrome (versions 23+) |
| 89 | +- Firefox (versions 65+) |
| 90 | +- Edge (versions 18+) |
| 91 | +- Safari (versions 14+) |
| 92 | +- Opera (versions 12.1+) |
| 93 | +- Chrome for Android & iOS Safari |
| 94 | + |
| 95 | +## 📊 Benefits of WebP |
| 96 | + |
| 97 | +- **Smaller File Size**: WebP images are typically 25-35% smaller than JPEGs at equivalent quality |
| 98 | +- **Faster Loading**: Reduced file size means faster page loading and better user experience |
| 99 | +- **SEO Benefits**: Page speed is a ranking factor for search engines |
| 100 | +- **Transparency Support**: WebP supports alpha channel transparency like PNG but with smaller file sizes |
| 101 | +- **Animation Support**: WebP can replace animated GIFs with much smaller file sizes |
| 102 | + |
| 103 | +## 🤝 Contributing |
| 104 | + |
| 105 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 106 | + |
| 107 | +1. Fork the repository |
| 108 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 109 | +3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
| 110 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 111 | +5. Open a Pull Request |
| 112 | + |
| 113 | +## 📜 License |
| 114 | + |
| 115 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 116 | + |
| 117 | +## 👨💻 Author |
| 118 | + |
| 119 | +- **l3dlp** - [GitHub](https://github.com/l3dlp) |
| 120 | + |
| 121 | +## 🙏 Acknowledgments |
| 122 | + |
| 123 | +- [browser-image-compression](https://github.com/Donaldcwl/browser-image-compression) for image optimization |
| 124 | +- [JSZip](https://stuk.github.io/jszip/) for generating ZIP files |
| 125 | +- [Font Awesome](https://fontawesome.com/) for the beautiful icons |
| 126 | +- [Tailwind CSS](https://tailwindcss.com/) for the utility-first CSS framework |
0 commit comments