Skip to content

Commit 0fc0897

Browse files
committed
feat: Implement a centralized file format configuration and update file path handling for dropped files.
1 parent 7827825 commit 0fc0897

18 files changed

Lines changed: 1427 additions & 544 deletions

File tree

FORMATS.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Supported File Formats
2+
3+
This document lists all file formats supported by OpenConvert and their conversion capabilities.
4+
5+
> **📍 Configuration Location**: All format definitions are centralized in [`src/config/formats.ts`](./src/config/formats.ts)
6+
7+
## Quick Reference
8+
9+
### Currently Supported (No External Dependencies)
10+
-**Images** - All image conversions work out-of-the-box using the built-in Sharp library
11+
12+
### Requires External Installation
13+
-**Documents** - Requires [Pandoc](https://pandoc.org/installing.html)
14+
-**Video** - Requires [FFmpeg](https://ffmpeg.org/download.html)
15+
-**Audio** - Requires [FFmpeg](https://ffmpeg.org/download.html)
16+
17+
---
18+
19+
## Image Formats (✅ Fully Supported)
20+
21+
| Format | Extension | Can Convert To | Description |
22+
|--------|-----------|----------------|-------------|
23+
| PNG | `.png` | jpg, webp, gif, bmp, avif, tiff, ico, pdf | Lossless compression with transparency |
24+
| JPEG | `.jpg`, `.jpeg` | png, webp, gif, bmp, avif, tiff, ico, pdf | Most widely supported, lossy compression |
25+
| WebP | `.webp` | png, jpg, gif, bmp, avif, tiff, ico, pdf | Modern web format, superior compression |
26+
| GIF | `.gif` | png, jpg, webp, bmp, avif, tiff | Supports animation and transparency |
27+
| BMP | `.bmp` | png, jpg, webp, gif, avif, tiff | Uncompressed bitmap |
28+
| AVIF | `.avif` | png, jpg, webp, gif, bmp, tiff | Best compression, modern browsers only |
29+
| TIFF | `.tiff`, `.tif` | png, jpg, webp, gif, bmp, avif | High quality, professional photography |
30+
| SVG | `.svg` | png, jpg, webp | Vector graphics (rasterized to output) |
31+
| ICO | `.ico` | png, jpg, webp | Icon format |
32+
| JPEG XL | `.jxl` | png, jpg, webp | Next-gen format with excellent compression |
33+
34+
---
35+
36+
## Document Formats (⏳ Requires Pandoc)
37+
38+
| Format | Extension | Can Convert To | Description |
39+
|--------|-----------|----------------|-------------|
40+
| PDF | `.pdf` | png, jpg, txt | Universal document standard |
41+
| EPUB | `.epub` | pdf, txt | eBook format |
42+
| DOCX | `.docx` | pdf, txt | Microsoft Word document |
43+
| TXT | `.txt` | pdf | Plain text |
44+
| RTF | `.rtf` | pdf, txt | Rich Text Format |
45+
| ODT | `.odt` | pdf, txt | OpenDocument Text |
46+
| XPS | `.xps` | pdf, png, jpg | XML Paper Specification |
47+
| CBZ | `.cbz` | pdf, png | Comic Book Archive |
48+
| MOBI | `.mobi` | pdf, epub, txt | Kindle format |
49+
| FB2 | `.fb2` | pdf, epub, txt | FictionBook eBook |
50+
51+
**Installation:**
52+
```bash
53+
# Ubuntu/Debian
54+
sudo apt install pandoc
55+
56+
# macOS
57+
brew install pandoc
58+
59+
# Windows
60+
winget install pandoc
61+
```
62+
63+
---
64+
65+
## Video Formats (⏳ Requires FFmpeg)
66+
67+
| Format | Extension | Can Convert To | Description |
68+
|--------|-----------|----------------|-------------|
69+
| MP4 | `.mp4` | mkv, avi, mov, webm, gif | Most widely supported |
70+
| MKV | `.mkv` | mp4, avi, mov, webm | Open container, multiple tracks |
71+
| AVI | `.avi` | mp4, mkv, mov, webm | Legacy Windows format |
72+
| MOV | `.mov` | mp4, mkv, avi, webm | Apple QuickTime |
73+
| WebM | `.webm` | mp4, mkv, avi, mov | Web-optimized format |
74+
| 3GP | `.3gp` | mp4, mkv, avi | Mobile video |
75+
| FLV | `.flv` | mp4, mkv, avi, webm | Legacy Flash video |
76+
| WMV | `.wmv` | mp4, mkv, avi, webm | Windows Media Video |
77+
78+
**Installation:**
79+
```bash
80+
# Ubuntu/Debian
81+
sudo apt install ffmpeg
82+
83+
# macOS
84+
brew install ffmpeg
85+
86+
# Windows
87+
winget install ffmpeg
88+
```
89+
90+
---
91+
92+
## Audio Formats (⏳ Requires FFmpeg)
93+
94+
| Format | Extension | Can Convert To | Description |
95+
|--------|-----------|----------------|-------------|
96+
| MP3 | `.mp3` | wav, aac, ogg, flac, m4a | Most popular lossy format |
97+
| WAV | `.wav` | mp3, aac, ogg, flac, m4a | Uncompressed, high quality |
98+
| AAC | `.aac` | mp3, wav, ogg, flac, m4a | Better quality than MP3 |
99+
| OGG | `.ogg` | mp3, wav, aac, flac, m4a | Open-source Vorbis |
100+
| FLAC | `.flac` | mp3, wav, aac, ogg, m4a | Lossless compression |
101+
| WMA | `.wma` | mp3, wav, aac, ogg, flac | Windows Media Audio |
102+
| M4A | `.m4a` | mp3, wav, aac, ogg, flac | MPEG-4 Audio (AAC) |
103+
104+
**Installation:** Same as video formats (FFmpeg)
105+
106+
---
107+
108+
## Adding New Formats
109+
110+
To add support for a new file format, edit [`src/config/formats.ts`](./src/config/formats.ts):
111+
112+
1. Add the format to the `FORMAT_MAP` object
113+
2. Specify its category (`image`, `document`, `video`, or `audio`)
114+
3. List which formats it can convert to in the `targets` array
115+
4. Optionally add a description
116+
117+
Example:
118+
```typescript
119+
heic: {
120+
category: 'image',
121+
label: 'HEIC',
122+
targets: ['jpg', 'png', 'webp'],
123+
description: 'High Efficiency Image Container - Apple format'
124+
},
125+
```
126+
127+
The format will automatically:
128+
- ✅ Appear in file dialogs
129+
- ✅ Show up in the UI with the correct category icon/color
130+
- ✅ Be available for conversion (if converter is implemented)
131+
132+
---
133+
134+
## Format Implementation Status
135+
136+
### Converters
137+
-**Image Converter** (`electron/converters/image-converter.ts`) - Uses Sharp library
138+
-**Document Converter** - Not yet implemented (requires Pandoc integration)
139+
-**Video Converter** - Not yet implemented (requires FFmpeg integration)
140+
-**Audio Converter** - Not yet implemented (requires FFmpeg integration)
141+
142+
### Roadmap
143+
1. **Phase 1** (Complete) - Image conversion with Sharp
144+
2. **Phase 2** (Planned) - Document conversion with Pandoc
145+
3. **Phase 3** (Planned) - Video/Audio conversion with FFmpeg
146+
4. **Phase 4** (Future) - Custom converters via plugin system
147+
148+
---
149+
150+
## Notes
151+
152+
- All file format data is defined in **one place**: [`src/config/formats.ts`](./src/config/formats.ts)
153+
- The format configuration is shared between frontend (React) and backend (Electron)
154+
- Conversion quality settings are defined in [`src/lib/settings.ts`](./src/lib/settings.ts)
155+
- File extensions are case-insensitive
156+
157+
---
158+
159+
## Related Files
160+
161+
- **Format Configuration**: [`src/config/formats.ts`](./src/config/formats.ts) - Single source of truth
162+
- **Image Converter**: [`electron/converters/image-converter.ts`](./electron/converters/image-converter.ts)
163+
- **Settings Schema**: [`src/lib/settings.ts`](./src/lib/settings.ts)
164+
- **Main Process**: [`electron/main.ts`](./electron/main.ts) - File dialog integration

0 commit comments

Comments
 (0)