@@ -97,16 +97,30 @@ brew install imagemagick ffmpeg
9797#include < pythonic/pythonic.hpp>
9898using namespace Pythonic ;
9999
100- // Print image in braille (black & white)
100+ // Print image in braille (black & white, high resolution )
101101print ("photo.png", Type::image);
102102
103- // Print image in true color
104- print("photo.png", Type::image, Render::colored);
103+ // Print image in true color (block characters)
104+ print("photo.png", Type::image, Mode::colored);
105+
106+ // Print image in colored braille (combines color + high resolution)
107+ print("photo.png", Type::image, Mode::colored_dot);
105108
106109// Play video in true color
107- print("video.mp4", Type::video, Render ::colored);
110+ print("video.mp4", Type::video, Mode ::colored);
108111```
109112
113+ ### Rendering Modes
114+
115+ Pythonic supports four rendering modes for images and videos:
116+
117+ | Mode | Description | Resolution | Colors |
118+ | ------------------- | --------------------------- | ---------------------- | ------------------------------ |
119+ | `Mode::bw_dot` | Braille patterns (default) | 8x terminal resolution | B&W |
120+ | `Mode::bw` | Block characters (▀▄█) | 2x terminal resolution | B&W |
121+ | `Mode::colored` | Block characters with color | 2x terminal resolution | True color |
122+ | `Mode::colored_dot` | Braille with color | 8x terminal resolution | True color (averaged per cell) |
123+
110124## Optional: Audio Playback for Videos
111125
112126To play videos with synchronized audio, you need SDL2 or PortAudio:
@@ -160,10 +174,10 @@ Use in code:
160174using namespace Pythonic ;
161175
162176// Play video with audio
163- print ("video.mp4", Type::video, Render::BW , Audio::on);
177+ print ("video.mp4", Type::video, Mode::bw_dot, Parser::default_parser , Audio::on);
164178
165179// Play video with audio in true color
166- print("video.mp4", Type::video, Render ::colored, Audio::on);
180+ print("video.mp4", Type::video, Mode ::colored, Parser::default_parser , Audio::on);
167181```
168182
169183> **Note:** If audio libraries are not available, `Audio::on` will automatically fall back to silent video playback.
@@ -197,6 +211,82 @@ cmake --build build
197211
198212> ** Note:** OpenCL support is optional. If not available, video rendering will use CPU with optimized buffering.
199213
214+ ## Optional: OpenCV for Webcam and Advanced Processing
215+
216+ For webcam capture and advanced image/video processing, you can enable OpenCV support:
217+
218+ ### Ubuntu/Debian:
219+
220+ ``` bash
221+ sudo apt-get install libopencv-dev
222+ ```
223+
224+ ### macOS:
225+
226+ ``` bash
227+ brew install opencv
228+ ```
229+
230+ ### Windows (vcpkg):
231+
232+ ``` bash
233+ vcpkg install opencv:x64-windows
234+ ```
235+
236+ Then build with OpenCV support:
237+
238+ ``` bash
239+ cmake -B build -DPYTHONIC_ENABLE_OPENCV=ON
240+ cmake --build build
241+ ```
242+
243+ Use in code:
244+
245+ ``` cpp
246+ #include < pythonic/pythonic.hpp>
247+ using namespace Pythonic ;
248+
249+ // Capture from webcam (requires OpenCV)
250+ print ("0", Type::webcam); // Use device 0
251+ print("/dev/video0", Type::webcam); // Linux device path
252+
253+ // Use OpenCV backend for image/video processing
254+ print("photo.png", Type::image, Mode::colored, Parser::opencv);
255+ print("video.mp4", Type::video, Mode::colored_dot, Parser::opencv);
256+ ```
257+
258+ ### Parser Backends
259+
260+ | Parser | Description | Supports |
261+ | ------------------------ | -------------------------------------------------- | -------------------- |
262+ | `Parser::default_parser` | FFmpeg for video, ImageMagick for images (default) | All media formats |
263+ | `Parser::opencv` | OpenCV for everything | Media files + webcam |
264+
265+ > **Note:** Webcam capture always requires OpenCV. If OpenCV is not available, an exception is thrown for webcam sources.
266+
267+ ## Proprietary Media Format (.pi, .pv)
268+
269+ Pythonic includes a media encryption system for protecting images and videos:
270+
271+ ```cpp
272+ #include <pythonic/pythonicMedia.hpp>
273+ using namespace pythonic::media;
274+
275+ // Convert image to encrypted Pythonic format
276+ convert("photo.jpg"); // Creates photo.pi
277+
278+ // Convert video to encrypted Pythonic format
279+ convert("video.mp4"); // Creates video.pv
280+
281+ // Revert back to original format
282+ revert("photo.pi"); // Creates photo_restored.jpg
283+ revert("video.pv"); // Creates video_restored.mp4
284+
285+ // Print encrypted files directly (auto-detected)
286+ print("photo.pi"); // Works like original image
287+ print("video.pv"); // Works like original video
288+ ```
289+
200290## Disclaimer:
201291
202292We’re looking for users to test the library and provide feedback!
0 commit comments