diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 04:55:21 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 04:55:21 +0000 |
commit | 65bdccbb14409302977131cf4d08830e68d7a42d (patch) | |
tree | 2cf392c1f7a2bae0479aa997a87e3295fb90902b | |
parent | 0e3237cff76eea87c92816c49c3de344f52630b9 (diff) |
automatic import of python-picharsso
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-picharsso.spec | 745 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 747 insertions, 0 deletions
@@ -0,0 +1 @@ +/picharsso-2.0.1.tar.gz diff --git a/python-picharsso.spec b/python-picharsso.spec new file mode 100644 index 0000000..c8ccbf3 --- /dev/null +++ b/python-picharsso.spec @@ -0,0 +1,745 @@ +%global _empty_manifest_terminate_build 0 +Name: python-picharsso +Version: 2.0.1 +Release: 1 +Summary: A utility for converting images to text art. +License: MIT +URL: https://pypi.org/project/picharsso/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ca/50/550f3ef989e6dfc4346422569508ea46e11c3046d05ed08b2708d963b48e/picharsso-2.0.1.tar.gz +BuildArch: noarch + +Requires: python3-click +Requires: python3-numpy +Requires: python3-pillow +Requires: python3-sty + +%description +# Picharsso + +<p align=center> + + <img src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/logo.webp" height="200px"/> + + <br> + <span>A utility for converting images to text art.</span> + <br> + <img alt="PyPI - Status" src="https://img.shields.io/pypi/status/picharsso"> + <a target="_blank" href="https://pypi.python.org/pypi/picharsso/"><img alt="pypi package" src="https://img.shields.io/pypi/v/picharsso?color=light%20green"></a> + <a target="_blank" href="https://github.com/kelvindecosta/picharsso/blob/master/LICENSE" title="License: MIT"><img alt="GitHub" src="https://img.shields.io/github/license/kelvindecosta/picharsso?color=blue"></a> +</p> + +<p align="center"> + <a href="#installation">Installation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/">Documentation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/examples/01-image/">Examples</a> + | + <a href="https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md">Contributing</a> +</p> + +## Installation + +Run the following command: + +```bash +pip install picharsso +``` + +This will: + +- download and install the [`picharsso` Python package](https://pypi.org/project/picharsso/) + (along with its dependencies). +- create an executable, `picharsso`, for the CLI (command line interface). + +> **Verification** +> +> To verify that Picharsso is installed, run: +> +> ```bash +> python -c "import picharsso" +> ``` + +## Commands + +Picharsso ships with a CLI that provides some basic functionality from the terminal. + +> **Usage** +> +> Run the following command to display a helpful message: +> +> ```bash +> picharsso -h +> ``` +> +> ``` +> Usage: picharsso [options] <command> [args] +> +> A utility for converting images to text art. +> +> Options: +> -h, --help Show this message and exit. +> +> Commands: +> draw Generate text art from an image. +> info Displays package information. +> ``` + +Consider the following image: + +<div align="center"> + <p> + <img alt="Apple logo" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/subjects/apple.webp" /> + </p> + <em>Apple Computer [Rob Janoff, 1977]</em> +</div> + +To convert an image to text art, run: + +```bash +picharsso draw -c -H 32 <path/to/image> gradient +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (gradient style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-gradient.webp" + /> +</div> + +> **Breakdown** +> +> | Argument | Effect | +> | :--------: | :------------------------------------------------------------------------------------ | +> | `-c` | Apply **image colors** to the output text. | +> | `-H 32` | Sets the **number of lines** of the output text to `32`. | +> | `gradient` | Use the [gradient style](https://kelvindecosta.github.io/picharsso/styles/gradient/). | +> +> Don't forget to replace `<path/to/image>`. + +Refer to the [CLI documentation](https://kelvindecosta.github.io/picharsso/commands/) to learn about the various **commands** and **arguments**. + +## Library + +The example from the previous section can be implemented in just a few lines of Python: + +```python +from PIL import Image +from picharsso import new_drawer + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Define drawer + drawer = new_drawer("braille", height=32, colorize=True) + + # Print drawer output + print(drawer(image)) +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-braille.webp" + /> +</div> + +> **Styles** +> +> Refer to the [Styles documentation](https://kelvindecosta.github.io/picharsso/styles/) for an in-depth guide to the **image processing behind Picharsso**. + +Now consider this animated GIF: + +<div align="center"> + <p> + <img alt="Nyan Cat" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/examples/02-gif/nyan.webp" /> + </p> + <em>Nyan Cat</em> +</div> + +With some more lines of code, you can animate GIFs in text! + +```python +import time + +from PIL import Image +from picharsso import new_drawer +from picharsso.utils import clear_screen, terminal_size + + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Get terminal height + height, _ = terminal_size() + + # Define drawer + drawer = new_drawer("braille", height=height, colorize=True, threshold=0) + + # Iterate over frames + texts = [] + for frame_id in range(image.n_frames): + # Select frame + image.seek(frame_id) + + # Save output for frame + texts.append(drawer(image)) + + # Iterate over saved outputs in a circular manner + num_frames = len(texts) + counter = 0 + while True: + # Refresh + clear_screen() + + # Print output + print(texts[counter]) + + # Set a delay between frames + time.sleep(1 / num_frames) + + # Circular increment + counter = (counter + 1) % num_frames +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Nyan Cat in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/examples/02-gif/nyan-braille.webp" + /> +</div> + +Refer to the [API documentation](https://kelvindecosta.github.io/picharsso/library/draw/) to learn about the various **classes** and **functions**. + +> **Examples** +> +> Check out some more [examples](https://kelvindecosta.github.io/picharsso/examples/01-image/). +> +> You can use an image [directly from the web](https://kelvindecosta.github.io/picharsso/examples/03-web/) too! + +## Contributing + +Do you have a feature request, bug report, or patch? Great! +Check out the [contributing guidelines](https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md)! + +## License + +Copyright (c) 2019 Kelvin DeCosta. +Released under the MIT License. +See [LICENSE](https://github.com/kelvindecosta/picharsso/blob/master/LICENSE) for details. + + + + +%package -n python3-picharsso +Summary: A utility for converting images to text art. +Provides: python-picharsso +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-picharsso +# Picharsso + +<p align=center> + + <img src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/logo.webp" height="200px"/> + + <br> + <span>A utility for converting images to text art.</span> + <br> + <img alt="PyPI - Status" src="https://img.shields.io/pypi/status/picharsso"> + <a target="_blank" href="https://pypi.python.org/pypi/picharsso/"><img alt="pypi package" src="https://img.shields.io/pypi/v/picharsso?color=light%20green"></a> + <a target="_blank" href="https://github.com/kelvindecosta/picharsso/blob/master/LICENSE" title="License: MIT"><img alt="GitHub" src="https://img.shields.io/github/license/kelvindecosta/picharsso?color=blue"></a> +</p> + +<p align="center"> + <a href="#installation">Installation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/">Documentation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/examples/01-image/">Examples</a> + | + <a href="https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md">Contributing</a> +</p> + +## Installation + +Run the following command: + +```bash +pip install picharsso +``` + +This will: + +- download and install the [`picharsso` Python package](https://pypi.org/project/picharsso/) + (along with its dependencies). +- create an executable, `picharsso`, for the CLI (command line interface). + +> **Verification** +> +> To verify that Picharsso is installed, run: +> +> ```bash +> python -c "import picharsso" +> ``` + +## Commands + +Picharsso ships with a CLI that provides some basic functionality from the terminal. + +> **Usage** +> +> Run the following command to display a helpful message: +> +> ```bash +> picharsso -h +> ``` +> +> ``` +> Usage: picharsso [options] <command> [args] +> +> A utility for converting images to text art. +> +> Options: +> -h, --help Show this message and exit. +> +> Commands: +> draw Generate text art from an image. +> info Displays package information. +> ``` + +Consider the following image: + +<div align="center"> + <p> + <img alt="Apple logo" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/subjects/apple.webp" /> + </p> + <em>Apple Computer [Rob Janoff, 1977]</em> +</div> + +To convert an image to text art, run: + +```bash +picharsso draw -c -H 32 <path/to/image> gradient +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (gradient style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-gradient.webp" + /> +</div> + +> **Breakdown** +> +> | Argument | Effect | +> | :--------: | :------------------------------------------------------------------------------------ | +> | `-c` | Apply **image colors** to the output text. | +> | `-H 32` | Sets the **number of lines** of the output text to `32`. | +> | `gradient` | Use the [gradient style](https://kelvindecosta.github.io/picharsso/styles/gradient/). | +> +> Don't forget to replace `<path/to/image>`. + +Refer to the [CLI documentation](https://kelvindecosta.github.io/picharsso/commands/) to learn about the various **commands** and **arguments**. + +## Library + +The example from the previous section can be implemented in just a few lines of Python: + +```python +from PIL import Image +from picharsso import new_drawer + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Define drawer + drawer = new_drawer("braille", height=32, colorize=True) + + # Print drawer output + print(drawer(image)) +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-braille.webp" + /> +</div> + +> **Styles** +> +> Refer to the [Styles documentation](https://kelvindecosta.github.io/picharsso/styles/) for an in-depth guide to the **image processing behind Picharsso**. + +Now consider this animated GIF: + +<div align="center"> + <p> + <img alt="Nyan Cat" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/examples/02-gif/nyan.webp" /> + </p> + <em>Nyan Cat</em> +</div> + +With some more lines of code, you can animate GIFs in text! + +```python +import time + +from PIL import Image +from picharsso import new_drawer +from picharsso.utils import clear_screen, terminal_size + + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Get terminal height + height, _ = terminal_size() + + # Define drawer + drawer = new_drawer("braille", height=height, colorize=True, threshold=0) + + # Iterate over frames + texts = [] + for frame_id in range(image.n_frames): + # Select frame + image.seek(frame_id) + + # Save output for frame + texts.append(drawer(image)) + + # Iterate over saved outputs in a circular manner + num_frames = len(texts) + counter = 0 + while True: + # Refresh + clear_screen() + + # Print output + print(texts[counter]) + + # Set a delay between frames + time.sleep(1 / num_frames) + + # Circular increment + counter = (counter + 1) % num_frames +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Nyan Cat in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/examples/02-gif/nyan-braille.webp" + /> +</div> + +Refer to the [API documentation](https://kelvindecosta.github.io/picharsso/library/draw/) to learn about the various **classes** and **functions**. + +> **Examples** +> +> Check out some more [examples](https://kelvindecosta.github.io/picharsso/examples/01-image/). +> +> You can use an image [directly from the web](https://kelvindecosta.github.io/picharsso/examples/03-web/) too! + +## Contributing + +Do you have a feature request, bug report, or patch? Great! +Check out the [contributing guidelines](https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md)! + +## License + +Copyright (c) 2019 Kelvin DeCosta. +Released under the MIT License. +See [LICENSE](https://github.com/kelvindecosta/picharsso/blob/master/LICENSE) for details. + + + + +%package help +Summary: Development documents and examples for picharsso +Provides: python3-picharsso-doc +%description help +# Picharsso + +<p align=center> + + <img src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/logo.webp" height="200px"/> + + <br> + <span>A utility for converting images to text art.</span> + <br> + <img alt="PyPI - Status" src="https://img.shields.io/pypi/status/picharsso"> + <a target="_blank" href="https://pypi.python.org/pypi/picharsso/"><img alt="pypi package" src="https://img.shields.io/pypi/v/picharsso?color=light%20green"></a> + <a target="_blank" href="https://github.com/kelvindecosta/picharsso/blob/master/LICENSE" title="License: MIT"><img alt="GitHub" src="https://img.shields.io/github/license/kelvindecosta/picharsso?color=blue"></a> +</p> + +<p align="center"> + <a href="#installation">Installation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/">Documentation</a> + | + <a href="https://kelvindecosta.github.io/picharsso/examples/01-image/">Examples</a> + | + <a href="https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md">Contributing</a> +</p> + +## Installation + +Run the following command: + +```bash +pip install picharsso +``` + +This will: + +- download and install the [`picharsso` Python package](https://pypi.org/project/picharsso/) + (along with its dependencies). +- create an executable, `picharsso`, for the CLI (command line interface). + +> **Verification** +> +> To verify that Picharsso is installed, run: +> +> ```bash +> python -c "import picharsso" +> ``` + +## Commands + +Picharsso ships with a CLI that provides some basic functionality from the terminal. + +> **Usage** +> +> Run the following command to display a helpful message: +> +> ```bash +> picharsso -h +> ``` +> +> ``` +> Usage: picharsso [options] <command> [args] +> +> A utility for converting images to text art. +> +> Options: +> -h, --help Show this message and exit. +> +> Commands: +> draw Generate text art from an image. +> info Displays package information. +> ``` + +Consider the following image: + +<div align="center"> + <p> + <img alt="Apple logo" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/subjects/apple.webp" /> + </p> + <em>Apple Computer [Rob Janoff, 1977]</em> +</div> + +To convert an image to text art, run: + +```bash +picharsso draw -c -H 32 <path/to/image> gradient +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (gradient style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-gradient.webp" + /> +</div> + +> **Breakdown** +> +> | Argument | Effect | +> | :--------: | :------------------------------------------------------------------------------------ | +> | `-c` | Apply **image colors** to the output text. | +> | `-H 32` | Sets the **number of lines** of the output text to `32`. | +> | `gradient` | Use the [gradient style](https://kelvindecosta.github.io/picharsso/styles/gradient/). | +> +> Don't forget to replace `<path/to/image>`. + +Refer to the [CLI documentation](https://kelvindecosta.github.io/picharsso/commands/) to learn about the various **commands** and **arguments**. + +## Library + +The example from the previous section can be implemented in just a few lines of Python: + +```python +from PIL import Image +from picharsso import new_drawer + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Define drawer + drawer = new_drawer("braille", height=32, colorize=True) + + # Print drawer output + print(drawer(image)) +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Apple logo in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/demo/apple-braille.webp" + /> +</div> + +> **Styles** +> +> Refer to the [Styles documentation](https://kelvindecosta.github.io/picharsso/styles/) for an in-depth guide to the **image processing behind Picharsso**. + +Now consider this animated GIF: + +<div align="center"> + <p> + <img alt="Nyan Cat" src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/examples/02-gif/nyan.webp" /> + </p> + <em>Nyan Cat</em> +</div> + +With some more lines of code, you can animate GIFs in text! + +```python +import time + +from PIL import Image +from picharsso import new_drawer +from picharsso.utils import clear_screen, terminal_size + + +if __name__ == "__main__": + # Open image + image = Image.open("<path/to/image>") + + # Get terminal height + height, _ = terminal_size() + + # Define drawer + drawer = new_drawer("braille", height=height, colorize=True, threshold=0) + + # Iterate over frames + texts = [] + for frame_id in range(image.n_frames): + # Select frame + image.seek(frame_id) + + # Save output for frame + texts.append(drawer(image)) + + # Iterate over saved outputs in a circular manner + num_frames = len(texts) + counter = 0 + while True: + # Refresh + clear_screen() + + # Print output + print(texts[counter]) + + # Set a delay between frames + time.sleep(1 / num_frames) + + # Circular increment + counter = (counter + 1) % num_frames +``` + +Here's what it should look like: + +<div align="center"> + <img + alt="Nyan Cat in text (Braille style)" + src="https://raw.githubusercontent.com/kelvindecosta/picharsso/master/docs/assets/images/outputs/examples/02-gif/nyan-braille.webp" + /> +</div> + +Refer to the [API documentation](https://kelvindecosta.github.io/picharsso/library/draw/) to learn about the various **classes** and **functions**. + +> **Examples** +> +> Check out some more [examples](https://kelvindecosta.github.io/picharsso/examples/01-image/). +> +> You can use an image [directly from the web](https://kelvindecosta.github.io/picharsso/examples/03-web/) too! + +## Contributing + +Do you have a feature request, bug report, or patch? Great! +Check out the [contributing guidelines](https://github.com/kelvindecosta/picharsso/blob/master/CONTRIBUTING.md)! + +## License + +Copyright (c) 2019 Kelvin DeCosta. +Released under the MIT License. +See [LICENSE](https://github.com/kelvindecosta/picharsso/blob/master/LICENSE) for details. + + + + +%prep +%autosetup -n picharsso-2.0.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-picharsso -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.1-1 +- Package Spec generated @@ -0,0 +1 @@ +db6316bf793c8b9bc543e8a3eb2add15 picharsso-2.0.1.tar.gz |