Name | ansiart JSON |
Version |
1.1.0
JSON |
| download |
home_page | None |
Summary | This is a library that converts the image to ANSI escape sequence, outputs it to the CLI, and saves/loads into a text file. |
upload_time | 2024-03-31 05:00:38 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | MIT License Copyright © 2024 苔コッコー Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
ansi
art
image
cli
terminal
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
日本語の説明は下にあります
# ansiart
## Overview
ansiart is a Python library that converts images into text art using ANSI escape sequences and outputs them to the command line interface (CLI).<br> It also provides the functionality to save and load ANSI escape sequences to and from text files.<br> By default, it uses True color, so use the truecolor\_to\_256color function as needed for conversion.
## Installation
```shell
pip install ansiart
```
## List of Functions
- image\_to\_ansi
- save\_ansi\_art
- load\_ansi\_art
- truecolor\_to\_256color
## Usage
### image\_to\_ansi: Convert an image to ANSI escape sequences and output to CLI
#### Overview
Takes the path of an image and converts that image into True Color ANSI art.
#### Arguments
1. Path of the image (str)
2. Width of the image to display (int, default=150)
3. Aspect ratio of the image to display (float, default=0.5)<br> The line spacing and aspect ratio of characters can vary by environment.
#### Example
```python
from ansiart import image_to_ansi
ansi_art = image_to_ansi("sample.png", 150, 0.5)
print(ansi_art)
```
### save\_ansi\_art: Save ANSI art to a file
#### Overview
Takes ANSI art and saves it to a specified text file.
#### Arguments
1. Path to save the ANSI file (str)
2. ANSI art to save (str)
#### Example
```python
from ansiart import save_ansi_art
save_ansi_art("ansi_art.txt", ansi_art)
```
### load\_ansi\_art: Load ANSI art from a file
#### Overview
Loads ANSI art from a text file and returns it.
#### Arguments
1. Path to the text file (str)
#### Example
```python
from ansiart import load_ansi_art
ansi_art = load_ansi_art("ansi_art.txt")
```
### truecolor\_to\_256color: Convert True Color ANSI art to 256 colors
#### Overview
Since the image\_to\_ansi function is based on True Color display, this function converts True Color ANSI art to 256 colors ANSI art for terminals that do not support True Color.
#### Arguments
1. ANSI art
#### Example
```python
from ansiart import truecolor_to_256color
ansi_art_256 = truecolor_to_256color(ansi_art)
```
## Contributing
If you would like to contribute, please open a pull request or issue on GitHub. All contributions are welcome.
## License
This project is released under the MIT License. See the LICENSE file for details.
* * *
# ansiart
## 概要
ansiartは、画像をANSIエスケープシーケンスを用いた文字アートに変換し、コマンドラインインターフェース(CLI)に出力するPythonライブラリです。<br>
また、ANSIエスケープシーケンスをテキストファイルに保存・読み込みする機能も提供します。<br>
デフォルトではTrue colorになっているため、適宜truecolor_to_256color関数を用いて変換してください。
## インストール方法
```shell
pip install ansiart
```
## 提供する関数の一覧
* image_to_ansi
* save_ansi_art
* load_ansi_art
* truecolor_to_256color
## 使用方法
### image_to_ansi : 画像をANSIエスケープシーケンスに変換してCLIに出力
#### 概要
画像のパスを受け取って、その画像をトゥルーカラーのANSIアートに変換します。
#### 引数
1. 画像のパス(str)
2. 表示する画像の横幅(int,デフォルト=150)
3. 表示する画像の縦横比(float,デフォルト=0.5) <br>
環境によって行間や文字の縦横比が異なるため。
#### 使用方法
```python
from ansiart import image_to_ansi
ansi_art = image_to_ansi("sample.png",150,0.5)
print(ansi_art)
```
### save_ansi_art : ANSIアートをファイルに保存
#### 概要
ANSIアートを受け取り、指定したテキストファイルに保存する。
#### 引数
1. ANSIファイルの保存先(str)
2. 保存するANSIアート(str)
#### 使用方法
```python
from ansiart import save_ansi_art
save_ansi_art("ansi_art.txt", ansi_art)
```
### load_ansi_art : ファイルからANSIアートを読み込む
#### 概要
テキストファイルからANSIアートを読み込み、それを返す
#### 引数
1. ANSIファイルの場所(str)
#### 使用方法
```python
from ansiart import load_ansi_art
ansi_art = load_ansi_art("ansi_art.txt")
```
### truecolor_to_256color : True colorのANSIアートを256色に変換する
#### 概要
image_to_ansi関数はTrue colorでの表示を基本とするため、サポートしていないターミナル向けにTrue colorのANSIアートを256色のANSIアートに変換します。
#### 引数
1. ANSIアート
#### 使用方法
```python
from ansiart import truecolor_to_256color
ansi_art_256 = truecolor_to_256color(ansi_art)
```
## 貢献方法
貢献したい方は、GitHubでプルリクエストやイシューを開いてください。あらゆる貢献を歓迎します。
## ライセンス
このプロジェクトはMITライセンスの下で公開されています。詳細はLICENSEファイルを参照してください。
Raw data
{
"_id": null,
"home_page": null,
"name": "ansiart",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "ansi, art, image, cli, terminal",
"author": null,
"author_email": "kokecoco <kokecoco.kw@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1d/16/ee88cb8a0adb29cb4cef4c794183ce9a3bd87c1df5f9a190fae6808803e6/ansiart-1.1.0.tar.gz",
"platform": null,
"description": "\u65e5\u672c\u8a9e\u306e\u8aac\u660e\u306f\u4e0b\u306b\u3042\u308a\u307e\u3059\r\n\r\n# ansiart\r\n\r\n## Overview\r\n\r\nansiart is a Python library that converts images into text art using ANSI escape sequences and outputs them to the command line interface (CLI).<br> It also provides the functionality to save and load ANSI escape sequences to and from text files.<br> By default, it uses True color, so use the truecolor\\_to\\_256color function as needed for conversion.\r\n\r\n## Installation\r\n```shell\r\npip install ansiart\r\n``` \r\n\r\n## List of Functions\r\n\r\n- image\\_to\\_ansi\r\n- save\\_ansi\\_art\r\n- load\\_ansi\\_art\r\n- truecolor\\_to\\_256color\r\n\r\n## Usage\r\n\r\n### image\\_to\\_ansi: Convert an image to ANSI escape sequences and output to CLI\r\n\r\n#### Overview\r\n\r\nTakes the path of an image and converts that image into True Color ANSI art.\r\n\r\n#### Arguments\r\n\r\n1. Path of the image (str)\r\n2. Width of the image to display (int, default=150)\r\n3. Aspect ratio of the image to display (float, default=0.5)<br> The line spacing and aspect ratio of characters can vary by environment.\r\n\r\n#### Example\r\n\r\n\r\n```python\r\nfrom ansiart import image_to_ansi\r\nansi_art = image_to_ansi(\"sample.png\", 150, 0.5)\r\nprint(ansi_art)\r\n``` \r\n\r\n### save\\_ansi\\_art: Save ANSI art to a file\r\n\r\n#### Overview\r\n\r\nTakes ANSI art and saves it to a specified text file.\r\n\r\n#### Arguments\r\n\r\n1. Path to save the ANSI file (str)\r\n2. ANSI art to save (str)\r\n\r\n#### Example\r\n\r\n\r\n```python\r\nfrom ansiart import save_ansi_art\r\nsave_ansi_art(\"ansi_art.txt\", ansi_art)\r\n``` \r\n\r\n### load\\_ansi\\_art: Load ANSI art from a file\r\n\r\n#### Overview\r\n\r\nLoads ANSI art from a text file and returns it.\r\n\r\n#### Arguments\r\n\r\n1. Path to the text file (str)\r\n\r\n#### Example\r\n\r\n\r\n\r\n```python\r\nfrom ansiart import load_ansi_art\r\nansi_art = load_ansi_art(\"ansi_art.txt\")\r\n```\r\n\r\n### truecolor\\_to\\_256color: Convert True Color ANSI art to 256 colors\r\n\r\n#### Overview\r\n\r\nSince the image\\_to\\_ansi function is based on True Color display, this function converts True Color ANSI art to 256 colors ANSI art for terminals that do not support True Color.\r\n\r\n#### Arguments\r\n\r\n1. ANSI art\r\n\r\n#### Example\r\n\r\n\r\n```python\r\nfrom ansiart import truecolor_to_256color\r\nansi_art_256 = truecolor_to_256color(ansi_art)\r\n```\r\n\r\n## Contributing\r\n\r\n\r\nIf you would like to contribute, please open a pull request or issue on GitHub. All contributions are welcome.\r\n\r\n\r\n## License\r\n\r\n\r\nThis project is released under the MIT License. See the LICENSE file for details.\r\n\r\n* * *\r\n\r\n# ansiart\r\n## \u6982\u8981\r\nansiart\u306f\u3001\u753b\u50cf\u3092ANSI\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u7528\u3044\u305f\u6587\u5b57\u30a2\u30fc\u30c8\u306b\u5909\u63db\u3057\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9(CLI)\u306b\u51fa\u529b\u3059\u308bPython\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<br>\r\n\u307e\u305f\u3001ANSI\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u30fb\u8aad\u307f\u8fbc\u307f\u3059\u308b\u6a5f\u80fd\u3082\u63d0\u4f9b\u3057\u307e\u3059\u3002<br>\r\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fTrue color\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u9069\u5b9ctruecolor_to_256color\u95a2\u6570\u3092\u7528\u3044\u3066\u5909\u63db\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n## \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\r\n```shell\r\npip install ansiart\r\n```\r\n## \u63d0\u4f9b\u3059\u308b\u95a2\u6570\u306e\u4e00\u89a7\r\n* image_to_ansi\r\n* save_ansi_art\r\n* load_ansi_art\r\n* truecolor_to_256color\r\n\r\n## \u4f7f\u7528\u65b9\u6cd5\r\n### image_to_ansi : \u753b\u50cf\u3092ANSI\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u306b\u5909\u63db\u3057\u3066CLI\u306b\u51fa\u529b\r\n#### \u6982\u8981\r\n\u753b\u50cf\u306e\u30d1\u30b9\u3092\u53d7\u3051\u53d6\u3063\u3066\u3001\u305d\u306e\u753b\u50cf\u3092\u30c8\u30a5\u30eb\u30fc\u30ab\u30e9\u30fc\u306eANSI\u30a2\u30fc\u30c8\u306b\u5909\u63db\u3057\u307e\u3059\u3002\r\n#### \u5f15\u6570\r\n1. \u753b\u50cf\u306e\u30d1\u30b9(str)\r\n2. \u8868\u793a\u3059\u308b\u753b\u50cf\u306e\u6a2a\u5e45(int,\u30c7\u30d5\u30a9\u30eb\u30c8=150)\r\n3. \u8868\u793a\u3059\u308b\u753b\u50cf\u306e\u7e26\u6a2a\u6bd4(float,\u30c7\u30d5\u30a9\u30eb\u30c8=0.5) <br>\r\n \u74b0\u5883\u306b\u3088\u3063\u3066\u884c\u9593\u3084\u6587\u5b57\u306e\u7e26\u6a2a\u6bd4\u304c\u7570\u306a\u308b\u305f\u3081\u3002\r\n#### \u4f7f\u7528\u65b9\u6cd5\r\n```python\r\nfrom ansiart import image_to_ansi\r\nansi_art = image_to_ansi(\"sample.png\",150,0.5)\r\nprint(ansi_art)\r\n```\r\n\r\n\r\n### save_ansi_art : ANSI\u30a2\u30fc\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\r\n#### \u6982\u8981\r\nANSI\u30a2\u30fc\u30c8\u3092\u53d7\u3051\u53d6\u308a\u3001\u6307\u5b9a\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u3002\r\n#### \u5f15\u6570\r\n1. ANSI\u30d5\u30a1\u30a4\u30eb\u306e\u4fdd\u5b58\u5148(str)\r\n2. \u4fdd\u5b58\u3059\u308bANSI\u30a2\u30fc\u30c8(str) \r\n#### \u4f7f\u7528\u65b9\u6cd5\r\n```python\r\nfrom ansiart import save_ansi_art\r\nsave_ansi_art(\"ansi_art.txt\", ansi_art)\r\n```\r\n### load_ansi_art : \u30d5\u30a1\u30a4\u30eb\u304b\u3089ANSI\u30a2\u30fc\u30c8\u3092\u8aad\u307f\u8fbc\u3080\r\n#### \u6982\u8981\r\n\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u304b\u3089ANSI\u30a2\u30fc\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u3001\u305d\u308c\u3092\u8fd4\u3059\r\n#### \u5f15\u6570\r\n1. ANSI\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u6240(str)\r\n#### \u4f7f\u7528\u65b9\u6cd5\r\n```python\r\nfrom ansiart import load_ansi_art\r\nansi_art = load_ansi_art(\"ansi_art.txt\")\r\n```\r\n### truecolor_to_256color : True color\u306eANSI\u30a2\u30fc\u30c8\u3092256\u8272\u306b\u5909\u63db\u3059\u308b\r\n#### \u6982\u8981\r\nimage_to_ansi\u95a2\u6570\u306fTrue color\u3067\u306e\u8868\u793a\u3092\u57fa\u672c\u3068\u3059\u308b\u305f\u3081\u3001\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u30bf\u30fc\u30df\u30ca\u30eb\u5411\u3051\u306bTrue color\u306eANSI\u30a2\u30fc\u30c8\u3092256\u8272\u306eANSI\u30a2\u30fc\u30c8\u306b\u5909\u63db\u3057\u307e\u3059\u3002\r\n#### \u5f15\u6570\r\n1. ANSI\u30a2\u30fc\u30c8\r\n#### \u4f7f\u7528\u65b9\u6cd5\r\n```python\r\nfrom ansiart import truecolor_to_256color\r\nansi_art_256 = truecolor_to_256color(ansi_art)\r\n```\r\n\r\n## \u8ca2\u732e\u65b9\u6cd5\r\n\r\n\r\n\u8ca2\u732e\u3057\u305f\u3044\u65b9\u306f\u3001GitHub\u3067\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8\u3084\u30a4\u30b7\u30e5\u30fc\u3092\u958b\u3044\u3066\u304f\u3060\u3055\u3044\u3002\u3042\u3089\u3086\u308b\u8ca2\u732e\u3092\u6b53\u8fce\u3057\u307e\u3059\u3002\r\n\r\n\r\n## \u30e9\u30a4\u30bb\u30f3\u30b9\r\n\r\n\r\n\u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fMIT\u30e9\u30a4\u30bb\u30f3\u30b9\u306e\u4e0b\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u8a73\u7d30\u306fLICENSE\u30d5\u30a1\u30a4\u30eb\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright \u00a9 2024 \u82d4\u30b3\u30c3\u30b3\u30fc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "This is a library that converts the image to ANSI escape sequence, outputs it to the CLI, and saves/loads into a text file.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://kokecoco.github.io/ansiart-docs/",
"Repository": "https://github.com/Kokecoco/ansiart"
},
"split_keywords": [
"ansi",
" art",
" image",
" cli",
" terminal"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8372f24a9c2da86287d5655e119c434760c3bb8e0d850569cb02390d775469f3",
"md5": "ae557dccaea258ce3a689fb9fd569c5f",
"sha256": "b17103d69be89b298d8f68488de79e4cc8a16b4c20789f7d9cde8fd4e18777cc"
},
"downloads": -1,
"filename": "ansiart-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ae557dccaea258ce3a689fb9fd569c5f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6348,
"upload_time": "2024-03-31T05:00:36",
"upload_time_iso_8601": "2024-03-31T05:00:36.015466Z",
"url": "https://files.pythonhosted.org/packages/83/72/f24a9c2da86287d5655e119c434760c3bb8e0d850569cb02390d775469f3/ansiart-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1d16ee88cb8a0adb29cb4cef4c794183ce9a3bd87c1df5f9a190fae6808803e6",
"md5": "4a2d81f290fcf03b6de6bb6b3e4b8af3",
"sha256": "277c7154282c9830abfc06b41c04b8d28b9e3ab2b2242b747970d89e7db99a99"
},
"downloads": -1,
"filename": "ansiart-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4a2d81f290fcf03b6de6bb6b3e4b8af3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5618,
"upload_time": "2024-03-31T05:00:38",
"upload_time_iso_8601": "2024-03-31T05:00:38.013636Z",
"url": "https://files.pythonhosted.org/packages/1d/16/ee88cb8a0adb29cb4cef4c794183ce9a3bd87c1df5f9a190fae6808803e6/ansiart-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-31 05:00:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Kokecoco",
"github_project": "ansiart",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ansiart"
}