File size: 2,023 Bytes
da84d7e
 
d42b3d2
da84d7e
 
 
 
 
 
 
 
 
 
357f3f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d42b3d2
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: Media Converter
emoji: 📸
colorFrom: pink
colorTo: yellow
sdk: gradio
sdk_version: 5.14.0
app_file: app.py
pinned: false
license: mit
short_description: Convert images and videos to different file formats
---

# Media Converter
![./attachments/demo-animation](./attachments/demo-animation.webp)
<!-- ![./attachments/demo-image](./attachments/demo-image.webp) -->

A web-based media conversion tool built with Gradio that supports:
- PNG to WebP image conversion
- MOV to animated WebP conversion

## Features

- **Image Conversion**
  - Convert PNG images to WebP format
  - Preserve transparency (RGBA)
  - Adjustable quality settings (10-100)
  - Real-time preview
  - File size and dimension statistics

- **Video Conversion**
  - Convert MOV videos to animated WebP
  - Adjustable FPS and quality
  - Preview of converted animation
  - Video statistics display

# Installation
1. Clone the repository
```bash
git clone https://huggingface.co/spaces/prasanthntu/media-converter
cd media-converter
```

2. Create and activate virtual environment (Optional, but recommended):
```bash
# 2.1 Create virtual environment
python -m venv media-converter-env

# 2.2 Activate virtual environment
# For Windows:
media-converter-env\Scripts\activate.bat  # CMD
media-converter-env\Scripts\Activate.ps1  # PowerShell

# For Mac/Linux:
source media-converter-env/bin/activate
```

3. Install dependencies:
```bash
pip install -r requirements.txt
```

# Usage
1. Start the application:
```bash
python app.py
```
For interactive development:
```bash
gradio app.py
```
2. Open the provided URL in your web browser (typically http://127.0.0.1:7860)

2. Use either tab:
- **PNG to WebP**: Upload PNG image and adjust quality
- **Video to WebP**: Upload MOV video and adjust FPS/quality

# Development
- Logs are stored in `image_converter.log`
T- emporary files are automatically cleaned up
- Built with Gradio for easy UI modifications


# Todo
## Enhancements
- [ ] Support asynchronus processing
- [ ] Add more file formats