ascii-art-python 0.2.1__tar.gz → 0.2.3__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.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Guillem Prieur
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Guillem Prieur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,207 +1,250 @@
1
- Metadata-Version: 2.4
2
- Name: ascii_art_python
3
- Version: 0.2.1
4
- Summary: A Python library and CLI tool for converting images and videos into ASCII art.
5
- Author-email: Guillem Prieur <prieurguillem38@gmail.com>
6
- Project-URL: Homepage, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python
7
- Project-URL: Bug Tracker, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python/-/issues
8
- Project-URL: Source Code, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python
9
- Keywords: ascii,ascii-art,image-to-ascii,video-to-ascii,cli,terminal,terminal-graphics,generator,converter
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
12
- Classifier: Intended Audience :: End Users/Desktop
13
- Classifier: Topic :: Multimedia :: Graphics
14
- Classifier: Topic :: Multimedia :: Video
15
- Classifier: Topic :: Terminals
16
- Classifier: Environment :: Console
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.9
19
- Classifier: Programming Language :: Python :: 3.10
20
- Classifier: Programming Language :: Python :: 3.11
21
- Classifier: Programming Language :: Python :: 3.12
22
- Classifier: License :: OSI Approved :: MIT License
23
- Classifier: Operating System :: OS Independent
24
- Requires-Python: >=3.9
25
- Description-Content-Type: text/markdown
26
- License-File: LICENSE
27
- Requires-Dist: pillow>=10.0.0
28
- Requires-Dist: tqdm>=4.65.0
29
- Requires-Dist: opencv-python-headless>=4.8.0
30
- Requires-Dist: moviepy>=1.0.3
31
- Requires-Dist: numpy>=1.24.0
32
- Dynamic: license-file
33
-
34
- # ASCII Art Python 🎨 - Convert Images & Videos to Terminal Graphics
35
-
36
- <div align="center">
37
-
38
- [![PyPI version](https://img.shields.io/pypi/v/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
39
- [![Python versions](https://img.shields.io/pypi/pyversions/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
40
- [![PyPI Downloads](https://img.shields.io/pypi/dm/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
41
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
-
43
- </div>
44
-
45
- This module provides advanced tools for converting classic images and videos into ASCII Art. It allows exporting the results as text files, new images, or new videos (with or without audio), and even playing videos directly in your terminal.
46
-
47
- ## 🔧 Features
48
-
49
- - Image to ASCII conversion
50
- - Video to ASCII animation with sound extraction
51
- - Play video directly in the terminal
52
- - Export to .txt, .png, .mp4, or .avi
53
-
54
- ## 📦 Installation
55
-
56
- You can install the module via pip:
57
-
58
- ```bash
59
- pip install ascii-art-python
60
- ```
61
-
62
- ## 🚀 Basic Usage
63
-
64
- To use the module, import it as follows:
65
-
66
- ```python
67
- import ascii_art_python as aap
68
- ```
69
-
70
- ## 📚 API Reference
71
-
72
- ### 1. Enumerations (Enums)
73
-
74
- These enumerations are used to define the export format or quality.
75
-
76
- `aap.new_school.ExportType` : Defines the file type when exporting an image or a video.
77
-
78
- - `aap.new_school.ExportType.IMAGE_FILE` (0): Exports as classic media (PNG image or MP4/AVI video).
79
-
80
- - `aap.new_school.ExportType.TEXT_FILE` (1): Exports as a plain text file (.txt or .vid.txt).
81
-
82
- `aap.new_school.VideoAscii.ExportQuality` : Defines the video compression quality (and the codec used) during export.
83
-
84
- - `aap.new_school.VideoAscii.ExportQuality.LOW` (0): Low quality (mp4v codec, .mp4 format).
85
-
86
- - `aap.new_school.VideoAscii.ExportQuality.HIGHT` (1): High quality (FFV1 codec, .avi format).
87
-
88
- ### 2. Class `ImageAscii`
89
-
90
- Manages the conversion and manipulation of a still image into ASCII art.
91
-
92
- #### Constructors
93
-
94
- - `ImageAscii(image: PIL.Image.Image, max_size: int = 100_000, grid: list[str] = None)`
95
- - Description: Initializes an instance from an image object of the PIL/Pillow library.
96
- - Parameters:
97
- - `image`: The source image (Pillow).
98
- - `max_size`: The maximum size (number of pixels/characters) for the generated ASCII image.
99
- - `grid`: The list of characters to use (from darkest to lightest). If None, uses the default grid.
100
- - `ImageAscii.from_path(path: str, max_size: int = 10_000, grid: list[str] = None) -> ImageAscii`
101
- - Description: Convenient class method to instantiate directly from a file path.
102
-
103
- #### Methods
104
-
105
- - `to_list() -> list[str]`
106
- - Description: Converts the image into a list of strings (one string per line).
107
- - `to_image() -> PIL.Image.Image`
108
- - Description: Generates and returns a new Pillow image where the ASCII has been drawn using a specific font (KreativeSquare.ttf by default).
109
- - `export(filename: str = "mika_export", mode: ExportType = 0) -> None`
110
- - Description: Exports the generated image to the disk.
111
- - Parameters:
112
- - `filename`: The target file name (without extension).
113
- - `mode`: If ExportType.IMAGE_FILE, saves a .png. If `ExportType.TEXT_FILE`, saves a .txt.
114
-
115
- ### 3. Class VideoAscii
116
-
117
- Manages the conversion of a complete video into an ASCII animation.
118
-
119
- #### Constructor
120
-
121
- - `VideoAscii(path: str, fps: int = 10, frame_size: int = 12_000)`
122
- - Description: Prepares a video for ASCII processing.
123
- - Parameters:
124
- - `path`: Path to the source video.
125
- - `fps`: Target frames per second for the ASCII render (maximum framerate).
126
- - `frame_size`: Maximum size of each processed frame.
127
-
128
- #### Properties
129
-
130
- - fps -> float: Retrieves the native FPS of the source video.
131
- - size -> tuple[int, int]: Retrieves the dimensions (width, height) of the exported ASCII video.
132
-
133
- #### Methods
134
-
135
- - `export(filename: str = "mika_export", export_type: ExportType = 0, quality: ExportQuality = 0, sound: bool = False)`
136
- - Description: Exports the processed video.
137
- - Parameters:
138
- - `filename`: The target file name (without extension).
139
- - `export_type`: If `IMAGE_FILE`, generates a video. If `TEXT_FILE`, generates a custom animated text file (.vid.txt).
140
- - `quality`: Determines the generated video codec if the export is a video file.
141
- - `sound`: If True, extracts audio from the source and adds it to the final exported video.
142
- - `print_in_terminal() -> None`
143
- - Description: Plays the source video as an ASCII animation directly in the terminal console, respecting the framerate limit (max_fps).
144
-
145
- #### Static Methods
146
-
147
- - `VideoAscii.print_from_txt(txt: str)`
148
- - Description: Reads and displays in the terminal the content of a .vid.txt file previously generated by the export(export_type=ExportType.TEXT_FILE) method.
149
- - `VideoAscii.transfer_audio(source_video_path: str, target_video_path: str, output_path: str)`
150
- - Description: Extracts audio from `source_video_path` and applies it to `target_video_path` to generate `output_path`.
151
-
152
- ## 💡 Usage Examples
153
-
154
- ### Example 1: Convert and Export an Image
155
-
156
- ```python
157
- import ascii_art_python as aap
158
- # Create an object from a local file
159
- my_image = aap.new_school.ImageAscii.from_path("my_image.jpg", max_size=50_000)
160
-
161
- # Display ASCII in the console
162
- print(my_image)
163
-
164
- # Export the ASCII image in text format (.txt)
165
- my_image.export("text_result", mode=aap.new_school.ExportType.TEXT_FILE)
166
-
167
- # Export the ASCII image as a new readable image (.png)
168
- my_image.export("image_result", mode=aap.new_school.ExportType.IMAGE_FILE)
169
- ```
170
-
171
- ### Example 2: Play a Video in the Terminal
172
-
173
- ```python
174
- import ascii_art_python as aap
175
-
176
- my_video = aap.new_school.VideoAscii("my_video.mp4", fps=15, frame_size=8_000)
177
-
178
- # Play the animation live in the terminal
179
- my_video.print_in_terminal()
180
- ```
181
-
182
- ### Example 3: Convert a Video with Sound
183
-
184
- ```python
185
- import ascii_art_python as aap
186
-
187
- my_video = aap.new_school.VideoAscii("my_video.mp4", fps=24, frame_size=15_000)
188
-
189
- # Export the video with sound in MP4 format (Low Quality by default)
190
- my_video.export(
191
- filename="final_ascii_video",
192
- export_type=aap.new_school.ExportType.IMAGE_FILE,
193
- sound=True
194
- )
195
- ```
196
-
197
- ## ⚠️ Troubleshooting
198
-
199
- ### Important Note Regarding OpenCV Dependencies
200
-
201
- This project uses **`opencv-python-headless`** for background image processing.
202
-
203
- Please be aware that installing both `opencv-python` (the standard version with GUI features) and `opencv-python-headless` in the **same Python environment** will cause conflicts. Doing so may break OpenCV's display capabilities (such as `cv2.imshow()`) in your other projects.
204
-
205
- **To avoid any issues, it is highly recommended to:**
206
- - **Use a Virtual Environment:** Always install this project inside an isolated virtual environment (using `venv`, `conda`, or Docker).
207
- - **Check Existing Packages:** If you are installing globally and already have `opencv-python` installed, please remove it first (`pip uninstall opencv-python`) before installing this project's requirements.
1
+ Metadata-Version: 2.4
2
+ Name: ascii_art_python
3
+ Version: 0.2.3
4
+ Summary: A Python library and CLI tool for converting images and videos into ASCII art.
5
+ Author-email: Guillem Prieur <prieurguillem38@gmail.com>
6
+ Project-URL: Homepage, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python
7
+ Project-URL: Bug Tracker, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python/-/issues
8
+ Project-URL: Source Code, https://gitlab.pprriieeuurr.fr/guill_prieur/ascii-art-python
9
+ Keywords: ascii,ascii-art,image-to-ascii,video-to-ascii,cli,terminal,terminal-graphics,generator,converter
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Topic :: Multimedia :: Graphics
14
+ Classifier: Topic :: Multimedia :: Video
15
+ Classifier: Topic :: Terminals
16
+ Classifier: Environment :: Console
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: pillow>=10.0.0
28
+ Requires-Dist: tqdm>=4.65.0
29
+ Requires-Dist: opencv-python-headless>=4.8.0
30
+ Requires-Dist: moviepy>=1.0.3
31
+ Requires-Dist: numpy>=1.24.0
32
+ Requires-Dist: importlib_resources; python_version < "3.10"
33
+ Dynamic: license-file
34
+
35
+ # ASCII Art Python 🎨 - Convert Images & Videos to Terminal Graphics
36
+
37
+ <div align="center">
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
40
+ [![Python versions](https://img.shields.io/pypi/pyversions/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
41
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/ascii-art-python.svg)](https://pypi.org/project/ascii-art-python/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+
44
+ </div>
45
+
46
+ This module provides advanced tools for converting classic images and videos into ASCII Art. It allows exporting the results as text files, new images, or new videos (with or without audio), and even playing videos directly in your terminal.
47
+
48
+ ## 👀 Examples
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
+
88
+ ![Example with the Nyan Cat video played in a terminal.](https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExczN5eXo0cHRyMnRzZjVxOHI4NXN1cjc2ZzIyNHQ5cTkyMW8weHVhYSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/n0MEinoLqWEdHb129d/giphy.gif)
89
+
90
+ ## 🔧 Features
91
+
92
+ - Image to ASCII conversion
93
+ - Video to ASCII animation with sound extraction
94
+ - Play video directly in the terminal
95
+ - Export to .txt, .png, .mp4, or .avi
96
+
97
+ ## 📦 Installation
98
+
99
+ You can install the module via pip:
100
+
101
+ ```bash
102
+ pip install ascii-art-python
103
+ ```
104
+
105
+ ## 🚀 Basic Usage
106
+
107
+ To use the module, import it as follows:
108
+
109
+ ```python
110
+ import ascii_art_python as aap
111
+ ```
112
+
113
+ ## 📚 API Reference
114
+
115
+ ### 1. Enumerations (Enums)
116
+
117
+ These enumerations are used to define the export format or quality.
118
+
119
+ `aap.new_school.ExportType` : Defines the file type when exporting an image or a video.
120
+
121
+ - `aap.new_school.ExportType.IMAGE_FILE` (0): Exports as classic media (PNG image or MP4/AVI video).
122
+
123
+ - `aap.new_school.ExportType.TEXT_FILE` (1): Exports as a plain text file (.txt or .vid.txt).
124
+
125
+ `aap.new_school.VideoAscii.ExportQuality` : Defines the video compression quality (and the codec used) during export.
126
+
127
+ - `aap.new_school.VideoAscii.ExportQuality.LOW` (0): Low quality (mp4v codec, .mp4 format).
128
+
129
+ - `aap.new_school.VideoAscii.ExportQuality.HIGH` (1): High quality (FFV1 codec, .avi format).
130
+
131
+ ### 2. Class `ImageAscii`
132
+
133
+ Manages the conversion and manipulation of a still image into ASCII art.
134
+
135
+ #### Constructors
136
+
137
+ - `ImageAscii(image: PIL.Image.Image, max_size: int = 100_000, grid: list[str] = None)`
138
+ - Description: Initializes an instance from an image object of the PIL/Pillow library.
139
+ - Parameters:
140
+ - `image`: The source image (Pillow).
141
+ - `max_size`: The maximum size (number of pixels/characters) for the generated ASCII image.
142
+ - `grid`: The list of characters to use (from darkest to lightest). If None, uses the default grid.
143
+ - `ImageAscii.from_path(path: str, max_size: int = 10_000, grid: list[str] = None) -> ImageAscii`
144
+ - Description: Convenient class method to instantiate directly from a file path.
145
+
146
+ #### Methods
147
+
148
+ - `to_list() -> list[str]`
149
+ - Description: Converts the image into a list of strings (one string per line).
150
+ - `to_image() -> PIL.Image.Image`
151
+ - Description: Generates and returns a new Pillow image where the ASCII has been drawn using a specific font (KreativeSquare.ttf by default).
152
+ - `export(filename: str = "mika_export", mode: ExportType = 0) -> None`
153
+ - Description: Exports the generated image to the disk.
154
+ - Parameters:
155
+ - `filename`: The target file name (without extension).
156
+ - `mode`: If ExportType.IMAGE_FILE, saves a .png. If `ExportType.TEXT_FILE`, saves a .txt.
157
+
158
+ ### 3. Class VideoAscii
159
+
160
+ Manages the conversion of a complete video into an ASCII animation.
161
+
162
+ #### Constructor
163
+
164
+ - `VideoAscii(path: str, fps: int = 10, frame_size: int = 12_000)`
165
+ - Description: Prepares a video for ASCII processing.
166
+ - Parameters:
167
+ - `path`: Path to the source video.
168
+ - `fps`: Target frames per second for the ASCII render (maximum framerate).
169
+ - `frame_size`: Maximum size of each processed frame.
170
+
171
+ #### Properties
172
+
173
+ - fps -> float: Retrieves the native FPS of the source video.
174
+ - size -> tuple[int, int]: Retrieves the dimensions (width, height) of the exported ASCII video.
175
+
176
+ #### Methods
177
+
178
+ - `export(filename: str = "mika_export", export_type: ExportType = 0, quality: ExportQuality = 0, sound: bool = False)`
179
+ - Description: Exports the processed video.
180
+ - Parameters:
181
+ - `filename`: The target file name (without extension).
182
+ - `export_type`: If `IMAGE_FILE`, generates a video. If `TEXT_FILE`, generates a custom animated text file (.vid.txt).
183
+ - `quality`: Determines the generated video codec if the export is a video file.
184
+ - `sound`: If True, extracts audio from the source and adds it to the final exported video.
185
+ - `print_in_terminal() -> None`
186
+ - Description: Plays the source video as an ASCII animation directly in the terminal console, respecting the framerate limit (max_fps).
187
+
188
+ #### Static Methods
189
+
190
+ - `VideoAscii.print_from_txt(txt: str)`
191
+ - Description: Reads and displays in the terminal the content of a .vid.txt file previously generated by the export(export_type=ExportType.TEXT_FILE) method.
192
+ - `VideoAscii.transfer_audio(source_video_path: str, target_video_path: str, output_path: str)`
193
+ - Description: Extracts audio from `source_video_path` and applies it to `target_video_path` to generate `output_path`.
194
+
195
+ ## 💡 Usage Examples
196
+
197
+ ### Example 1: Convert and Export an Image
198
+
199
+ ```python
200
+ import ascii_art_python as aap
201
+ # Create an object from a local file
202
+ my_image = aap.new_school.ImageAscii.from_path("my_image.jpg", max_size=50_000)
203
+
204
+ # Display ASCII in the console
205
+ print(my_image)
206
+
207
+ # Export the ASCII image in text format (.txt)
208
+ my_image.export("text_result", mode=aap.new_school.ExportType.TEXT_FILE)
209
+
210
+ # Export the ASCII image as a new readable image (.png)
211
+ my_image.export("image_result", mode=aap.new_school.ExportType.IMAGE_FILE)
212
+ ```
213
+
214
+ ### Example 2: Play a Video in the Terminal
215
+
216
+ ```python
217
+ import ascii_art_python as aap
218
+
219
+ my_video = aap.new_school.VideoAscii("my_video.mp4", fps=15, frame_size=8_000)
220
+
221
+ # Play the animation live in the terminal
222
+ my_video.print_in_terminal()
223
+ ```
224
+
225
+ ### Example 3: Convert a Video with Sound
226
+
227
+ ```python
228
+ import ascii_art_python as aap
229
+
230
+ my_video = aap.new_school.VideoAscii("my_video.mp4", fps=24, frame_size=15_000)
231
+
232
+ # Export the video with sound in MP4 format (Low Quality by default)
233
+ my_video.export(
234
+ filename="final_ascii_video",
235
+ export_type=aap.new_school.ExportType.IMAGE_FILE,
236
+ sound=True
237
+ )
238
+ ```
239
+
240
+ ## ⚠️ Troubleshooting
241
+
242
+ ### Important Note Regarding OpenCV Dependencies
243
+
244
+ This project uses **`opencv-python-headless`** for background image processing.
245
+
246
+ Please be aware that installing both `opencv-python` (the standard version with GUI features) and `opencv-python-headless` in the **same Python environment** will cause conflicts. Doing so may break OpenCV's display capabilities (such as `cv2.imshow()`) in your other projects.
247
+
248
+ **To avoid any issues, it is highly recommended to:**
249
+ - **Use a Virtual Environment:** Always install this project inside an isolated virtual environment (using `venv`, `conda`, or Docker).
250
+ - **Check Existing Packages:** If you are installing globally and already have `opencv-python` installed, please remove it first (`pip uninstall opencv-python`) before installing this project's requirements.