easyconvio 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Joao Manoel Feck
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,313 @@
1
+ Metadata-Version: 2.4
2
+ Name: easyconvio
3
+ Version: 0.2.0
4
+ Summary: A universal file conversion library for Python with a fluent API
5
+ Author-email: Joao Feck <joaomfeck@gmail.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/joaomfeck/easyconvio
8
+ Project-URL: Repository, https://github.com/joaomfeck/easyconvio
9
+ Project-URL: Issues, https://github.com/joaomfeck/easyconvio/issues
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Multimedia
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: Pillow
25
+ Requires-Dist: pydub
26
+ Requires-Dist: pypandoc
27
+ Requires-Dist: moviepy
28
+ Requires-Dist: audioop-lts; python_version >= "3.13"
29
+ Provides-Extra: presentations
30
+ Requires-Dist: python-pptx; extra == "presentations"
31
+ Provides-Extra: vectors
32
+ Requires-Dist: cairosvg; extra == "vectors"
33
+ Provides-Extra: fonts
34
+ Requires-Dist: fonttools; extra == "fonts"
35
+ Requires-Dist: brotli; extra == "fonts"
36
+ Provides-Extra: archives
37
+ Requires-Dist: py7zr; extra == "archives"
38
+ Requires-Dist: rarfile; extra == "archives"
39
+ Provides-Extra: cad
40
+ Requires-Dist: ezdxf; extra == "cad"
41
+ Requires-Dist: matplotlib; extra == "cad"
42
+ Provides-Extra: all
43
+ Requires-Dist: python-pptx; extra == "all"
44
+ Requires-Dist: cairosvg; extra == "all"
45
+ Requires-Dist: fonttools; extra == "all"
46
+ Requires-Dist: brotli; extra == "all"
47
+ Requires-Dist: py7zr; extra == "all"
48
+ Requires-Dist: rarfile; extra == "all"
49
+ Requires-Dist: ezdxf; extra == "all"
50
+ Requires-Dist: matplotlib; extra == "all"
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest; extra == "dev"
53
+ Dynamic: license-file
54
+
55
+ # easyconvio
56
+
57
+ A universal file conversion and manipulation library for Python with a fluent API.
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ pip install easyconvio
63
+ ```
64
+
65
+ With optional extras:
66
+
67
+ ```bash
68
+ pip install easyconvio[all] # everything
69
+ pip install easyconvio[presentations] # PowerPoint support
70
+ pip install easyconvio[vectors] # SVG conversion via cairosvg
71
+ pip install easyconvio[fonts] # font conversion via fonttools
72
+ pip install easyconvio[archives] # 7z and RAR support
73
+ pip install easyconvio[cad] # DXF support via ezdxf
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ### Images
79
+
80
+ ```python
81
+ import easyconvio as ec
82
+
83
+ img = ec.read_jpg("photo.jpg")
84
+ print(img) # <ImageFile 'photo.jpg' (jpg)>
85
+ print(img.size) # (1920, 1080)
86
+ print(img.mode) # RGB
87
+
88
+ # Geometric transforms
89
+ img = img.resize(800, 600)
90
+ img = img.crop(0, 0, 400, 300)
91
+ img = img.rotate(90)
92
+ img = img.flip_horizontal()
93
+ img = img.thumbnail(200, 200)
94
+
95
+ # Color adjustments
96
+ img = ec.read_jpg("photo.jpg")
97
+ img = img.brightness(1.2)
98
+ img = img.contrast(1.5)
99
+ img = img.sharpness(2.0)
100
+ img = img.saturation(0.8)
101
+ img = img.grayscale()
102
+ img = img.sepia()
103
+ img = img.invert()
104
+ img = img.auto_contrast()
105
+ img = img.equalize()
106
+ img = img.opacity(0.5)
107
+
108
+ # Filters and compositing
109
+ img = ec.read_jpg("photo.jpg")
110
+ img = img.blur(radius=3)
111
+ img = img.add_border(10, color="red")
112
+ img = img.paste("overlay.png", 50, 50)
113
+
114
+ # Convert
115
+ img.to_png("photo.png")
116
+ img.to_webp("photo.webp", quality=80)
117
+ img.to("gif", "photo.gif") # generic .to() also works
118
+ ```
119
+
120
+ ### Audio
121
+
122
+ ```python
123
+ audio = ec.read_mp3("song.mp3")
124
+ print(audio.duration) # 180.5 (seconds)
125
+ print(audio.channels) # 2
126
+ print(audio.sample_rate) # 44100
127
+
128
+ # Editing
129
+ audio = audio.trim(start=10, end=60)
130
+ audio = audio.append("outro.mp3")
131
+ audio = audio.overlay("effect.wav", position=5)
132
+ audio = audio.repeat(2)
133
+ audio = audio.reverse()
134
+ audio = audio.silence(3)
135
+
136
+ # Effects
137
+ audio = ec.read_mp3("song.mp3")
138
+ audio = audio.volume(6)
139
+ audio = audio.normalize()
140
+ audio = audio.fade_in(2)
141
+ audio = audio.fade_out(3)
142
+ audio = audio.low_pass_filter(3000)
143
+ audio = audio.high_pass_filter(200)
144
+ audio = audio.speed(1.5)
145
+
146
+ # Format settings
147
+ audio = audio.set_channels(1) # mono
148
+ audio = audio.set_frame_rate(22050)
149
+
150
+ # Convert
151
+ audio.to_wav("song.wav")
152
+ audio.to_flac("song.flac")
153
+ audio.to("ogg", "song.ogg")
154
+ ```
155
+
156
+ ### Video
157
+
158
+ ```python
159
+ video = ec.read_mp4("clip.mp4")
160
+ print(video.duration) # 120.0 (seconds)
161
+ print(video.size) # (1920, 1080)
162
+ print(video.fps) # 30.0
163
+
164
+ # Editing
165
+ video = video.clip(0, 30)
166
+ video = video.resize(1280, 720)
167
+ video = video.crop(0, 0, 640, 360)
168
+ video = video.concatenate("clip2.mp4")
169
+ video = video.loop(3)
170
+
171
+ # Speed and time
172
+ video = ec.read_mp4("clip.mp4")
173
+ video = video.speed(2.0)
174
+ video = video.reverse()
175
+ video = video.set_fps(24)
176
+
177
+ # Visual effects
178
+ video = ec.read_mp4("clip.mp4")
179
+ video = video.rotate(90)
180
+ video = video.flip_horizontal()
181
+ video = video.grayscale()
182
+ video = video.brightness(1.3)
183
+ video = video.fade_in(2)
184
+ video = video.fade_out(2)
185
+
186
+ # Audio
187
+ video = ec.read_mp4("clip.mp4")
188
+ video = video.mute()
189
+ video = video.add_audio("music.mp3")
190
+ video = video.volume(0.5)
191
+
192
+ # Extract
193
+ video = ec.read_mp4("clip.mp4")
194
+ video.extract_audio("clip_audio.mp3")
195
+ video.snapshot(5.0, "frame_5s.png")
196
+
197
+ # Convert
198
+ video = ec.read_mp4("clip.mp4")
199
+ video.to_webm("clip.webm")
200
+ video.to("avi", "clip.avi")
201
+ ```
202
+
203
+ ### Documents
204
+
205
+ ```python
206
+ doc = ec.read_docx("report.docx")
207
+ doc.to_pdf("report.pdf")
208
+ doc.to_html("report.html")
209
+ doc.to_md("report.md")
210
+ doc.to_latex("report.tex")
211
+ doc.to_rst("report.rst")
212
+ doc.to("odt", "report.odt")
213
+ ```
214
+
215
+ ### Ebooks
216
+
217
+ ```python
218
+ ebook = ec.read_epub("book.epub")
219
+ ebook.to_mobi("book.mobi")
220
+ ebook.to_pdf("book.pdf")
221
+ ebook.to_html("book.html")
222
+ ebook.to("docx", "book.docx")
223
+ ```
224
+
225
+ ### Archives
226
+
227
+ ```python
228
+ archive = ec.read_zip("files.zip")
229
+ print(archive.file_count) # 42
230
+ print(archive.list_files()) # ['file1.txt', 'dir/file2.txt', ...]
231
+
232
+ archive.extract("output_dir/")
233
+ archive.extract_file("file1.txt", "output_dir/")
234
+
235
+ # Convert between archive formats
236
+ archive.to_tar("files.tar")
237
+ archive.to_gz("files.tar.gz")
238
+ archive.to_7z("files.7z")
239
+ archive.to("bz2", "files.tar.bz2")
240
+ ```
241
+
242
+ ### Presentations
243
+
244
+ ```python
245
+ pres = ec.read_pptx("slides.pptx")
246
+ print(pres.slide_count) # 15
247
+ print(pres.extract_text()) # ['Slide 1 text...', 'Slide 2 text...']
248
+
249
+ pres.extract_images("slides_images/")
250
+ pres = pres.remove_slide(0)
251
+
252
+ pres.to_pdf("slides.pdf")
253
+ pres.to_pptx("slides_copy.pptx")
254
+ pres.to("odp", "slides.odp")
255
+ ```
256
+
257
+ ### Vectors
258
+
259
+ ```python
260
+ svg = ec.read_svg("logo.svg")
261
+ svg = svg.scale(2.0)
262
+
263
+ svg.to_png("logo.png")
264
+ svg.to_pdf("logo.pdf")
265
+ svg.to_eps("logo.eps")
266
+ svg.to("emf", "logo.emf")
267
+ ```
268
+
269
+ ### Fonts
270
+
271
+ ```python
272
+ font = ec.read_ttf("font.ttf")
273
+ print(font.family_name) # 'Roboto'
274
+ print(font.style) # 'Regular'
275
+ print(font.glyph_count) # 1294
276
+ print(font.info())
277
+
278
+ font = font.subset("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
279
+ font.to_woff2("font_subset.woff2")
280
+ font.to_woff("font.woff")
281
+ font.to("otf", "font.otf")
282
+ ```
283
+
284
+ ### CAD
285
+
286
+ ```python
287
+ cad = ec.read_dxf("drawing.dxf")
288
+ print(cad.layers) # ['0', 'Walls', 'Doors', ...]
289
+ print(cad.entity_count) # 256
290
+
291
+ cad.to_png("drawing.png", dpi=300)
292
+ cad.to_svg("drawing.svg")
293
+ cad.to_pdf("drawing.pdf")
294
+ ```
295
+
296
+ ## Supported Formats
297
+
298
+ | Category | Formats |
299
+ |---------------|----------------------------------------------------------------------|
300
+ | Images | jpg, png, gif, bmp, tiff, webp, ico, tga, ppm, pcx, dds, heic, heif |
301
+ | Audio | mp3, wav, ogg, flac, aac, wma, m4a, aiff, ac3, opus, amr, au |
302
+ | Video | mp4, avi, mov, mkv, webm, flv, ogv, wmv, 3gp, ts, mpeg, mpg |
303
+ | Documents | pdf, docx, doc, odt, rtf, txt, html, md, latex, csv |
304
+ | Ebooks | epub, mobi, azw3, fb2, lrf, pdb, snb |
305
+ | Archives | zip, tar, gz, tgz, bz2, xz, 7z, rar |
306
+ | Presentations | pptx, ppt, odp |
307
+ | Vectors | svg, eps, ai, wmf, emf, cdr |
308
+ | Fonts | ttf, otf, woff, woff2 |
309
+ | CAD | dxf |
310
+
311
+ ## License
312
+
313
+ BSD 3-Clause
@@ -0,0 +1,259 @@
1
+ # easyconvio
2
+
3
+ A universal file conversion and manipulation library for Python with a fluent API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install easyconvio
9
+ ```
10
+
11
+ With optional extras:
12
+
13
+ ```bash
14
+ pip install easyconvio[all] # everything
15
+ pip install easyconvio[presentations] # PowerPoint support
16
+ pip install easyconvio[vectors] # SVG conversion via cairosvg
17
+ pip install easyconvio[fonts] # font conversion via fonttools
18
+ pip install easyconvio[archives] # 7z and RAR support
19
+ pip install easyconvio[cad] # DXF support via ezdxf
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Images
25
+
26
+ ```python
27
+ import easyconvio as ec
28
+
29
+ img = ec.read_jpg("photo.jpg")
30
+ print(img) # <ImageFile 'photo.jpg' (jpg)>
31
+ print(img.size) # (1920, 1080)
32
+ print(img.mode) # RGB
33
+
34
+ # Geometric transforms
35
+ img = img.resize(800, 600)
36
+ img = img.crop(0, 0, 400, 300)
37
+ img = img.rotate(90)
38
+ img = img.flip_horizontal()
39
+ img = img.thumbnail(200, 200)
40
+
41
+ # Color adjustments
42
+ img = ec.read_jpg("photo.jpg")
43
+ img = img.brightness(1.2)
44
+ img = img.contrast(1.5)
45
+ img = img.sharpness(2.0)
46
+ img = img.saturation(0.8)
47
+ img = img.grayscale()
48
+ img = img.sepia()
49
+ img = img.invert()
50
+ img = img.auto_contrast()
51
+ img = img.equalize()
52
+ img = img.opacity(0.5)
53
+
54
+ # Filters and compositing
55
+ img = ec.read_jpg("photo.jpg")
56
+ img = img.blur(radius=3)
57
+ img = img.add_border(10, color="red")
58
+ img = img.paste("overlay.png", 50, 50)
59
+
60
+ # Convert
61
+ img.to_png("photo.png")
62
+ img.to_webp("photo.webp", quality=80)
63
+ img.to("gif", "photo.gif") # generic .to() also works
64
+ ```
65
+
66
+ ### Audio
67
+
68
+ ```python
69
+ audio = ec.read_mp3("song.mp3")
70
+ print(audio.duration) # 180.5 (seconds)
71
+ print(audio.channels) # 2
72
+ print(audio.sample_rate) # 44100
73
+
74
+ # Editing
75
+ audio = audio.trim(start=10, end=60)
76
+ audio = audio.append("outro.mp3")
77
+ audio = audio.overlay("effect.wav", position=5)
78
+ audio = audio.repeat(2)
79
+ audio = audio.reverse()
80
+ audio = audio.silence(3)
81
+
82
+ # Effects
83
+ audio = ec.read_mp3("song.mp3")
84
+ audio = audio.volume(6)
85
+ audio = audio.normalize()
86
+ audio = audio.fade_in(2)
87
+ audio = audio.fade_out(3)
88
+ audio = audio.low_pass_filter(3000)
89
+ audio = audio.high_pass_filter(200)
90
+ audio = audio.speed(1.5)
91
+
92
+ # Format settings
93
+ audio = audio.set_channels(1) # mono
94
+ audio = audio.set_frame_rate(22050)
95
+
96
+ # Convert
97
+ audio.to_wav("song.wav")
98
+ audio.to_flac("song.flac")
99
+ audio.to("ogg", "song.ogg")
100
+ ```
101
+
102
+ ### Video
103
+
104
+ ```python
105
+ video = ec.read_mp4("clip.mp4")
106
+ print(video.duration) # 120.0 (seconds)
107
+ print(video.size) # (1920, 1080)
108
+ print(video.fps) # 30.0
109
+
110
+ # Editing
111
+ video = video.clip(0, 30)
112
+ video = video.resize(1280, 720)
113
+ video = video.crop(0, 0, 640, 360)
114
+ video = video.concatenate("clip2.mp4")
115
+ video = video.loop(3)
116
+
117
+ # Speed and time
118
+ video = ec.read_mp4("clip.mp4")
119
+ video = video.speed(2.0)
120
+ video = video.reverse()
121
+ video = video.set_fps(24)
122
+
123
+ # Visual effects
124
+ video = ec.read_mp4("clip.mp4")
125
+ video = video.rotate(90)
126
+ video = video.flip_horizontal()
127
+ video = video.grayscale()
128
+ video = video.brightness(1.3)
129
+ video = video.fade_in(2)
130
+ video = video.fade_out(2)
131
+
132
+ # Audio
133
+ video = ec.read_mp4("clip.mp4")
134
+ video = video.mute()
135
+ video = video.add_audio("music.mp3")
136
+ video = video.volume(0.5)
137
+
138
+ # Extract
139
+ video = ec.read_mp4("clip.mp4")
140
+ video.extract_audio("clip_audio.mp3")
141
+ video.snapshot(5.0, "frame_5s.png")
142
+
143
+ # Convert
144
+ video = ec.read_mp4("clip.mp4")
145
+ video.to_webm("clip.webm")
146
+ video.to("avi", "clip.avi")
147
+ ```
148
+
149
+ ### Documents
150
+
151
+ ```python
152
+ doc = ec.read_docx("report.docx")
153
+ doc.to_pdf("report.pdf")
154
+ doc.to_html("report.html")
155
+ doc.to_md("report.md")
156
+ doc.to_latex("report.tex")
157
+ doc.to_rst("report.rst")
158
+ doc.to("odt", "report.odt")
159
+ ```
160
+
161
+ ### Ebooks
162
+
163
+ ```python
164
+ ebook = ec.read_epub("book.epub")
165
+ ebook.to_mobi("book.mobi")
166
+ ebook.to_pdf("book.pdf")
167
+ ebook.to_html("book.html")
168
+ ebook.to("docx", "book.docx")
169
+ ```
170
+
171
+ ### Archives
172
+
173
+ ```python
174
+ archive = ec.read_zip("files.zip")
175
+ print(archive.file_count) # 42
176
+ print(archive.list_files()) # ['file1.txt', 'dir/file2.txt', ...]
177
+
178
+ archive.extract("output_dir/")
179
+ archive.extract_file("file1.txt", "output_dir/")
180
+
181
+ # Convert between archive formats
182
+ archive.to_tar("files.tar")
183
+ archive.to_gz("files.tar.gz")
184
+ archive.to_7z("files.7z")
185
+ archive.to("bz2", "files.tar.bz2")
186
+ ```
187
+
188
+ ### Presentations
189
+
190
+ ```python
191
+ pres = ec.read_pptx("slides.pptx")
192
+ print(pres.slide_count) # 15
193
+ print(pres.extract_text()) # ['Slide 1 text...', 'Slide 2 text...']
194
+
195
+ pres.extract_images("slides_images/")
196
+ pres = pres.remove_slide(0)
197
+
198
+ pres.to_pdf("slides.pdf")
199
+ pres.to_pptx("slides_copy.pptx")
200
+ pres.to("odp", "slides.odp")
201
+ ```
202
+
203
+ ### Vectors
204
+
205
+ ```python
206
+ svg = ec.read_svg("logo.svg")
207
+ svg = svg.scale(2.0)
208
+
209
+ svg.to_png("logo.png")
210
+ svg.to_pdf("logo.pdf")
211
+ svg.to_eps("logo.eps")
212
+ svg.to("emf", "logo.emf")
213
+ ```
214
+
215
+ ### Fonts
216
+
217
+ ```python
218
+ font = ec.read_ttf("font.ttf")
219
+ print(font.family_name) # 'Roboto'
220
+ print(font.style) # 'Regular'
221
+ print(font.glyph_count) # 1294
222
+ print(font.info())
223
+
224
+ font = font.subset("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
225
+ font.to_woff2("font_subset.woff2")
226
+ font.to_woff("font.woff")
227
+ font.to("otf", "font.otf")
228
+ ```
229
+
230
+ ### CAD
231
+
232
+ ```python
233
+ cad = ec.read_dxf("drawing.dxf")
234
+ print(cad.layers) # ['0', 'Walls', 'Doors', ...]
235
+ print(cad.entity_count) # 256
236
+
237
+ cad.to_png("drawing.png", dpi=300)
238
+ cad.to_svg("drawing.svg")
239
+ cad.to_pdf("drawing.pdf")
240
+ ```
241
+
242
+ ## Supported Formats
243
+
244
+ | Category | Formats |
245
+ |---------------|----------------------------------------------------------------------|
246
+ | Images | jpg, png, gif, bmp, tiff, webp, ico, tga, ppm, pcx, dds, heic, heif |
247
+ | Audio | mp3, wav, ogg, flac, aac, wma, m4a, aiff, ac3, opus, amr, au |
248
+ | Video | mp4, avi, mov, mkv, webm, flv, ogv, wmv, 3gp, ts, mpeg, mpg |
249
+ | Documents | pdf, docx, doc, odt, rtf, txt, html, md, latex, csv |
250
+ | Ebooks | epub, mobi, azw3, fb2, lrf, pdb, snb |
251
+ | Archives | zip, tar, gz, tgz, bz2, xz, 7z, rar |
252
+ | Presentations | pptx, ppt, odp |
253
+ | Vectors | svg, eps, ai, wmf, emf, cdr |
254
+ | Fonts | ttf, otf, woff, woff2 |
255
+ | CAD | dxf |
256
+
257
+ ## License
258
+
259
+ BSD 3-Clause