Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README in Simplified Chinese #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
![](https://github.com/RameshAditya/asciify/blob/master/github-resources/logo.JPG)
# 通过Python将图片转换成ASCII图像(ASCII Art)

![](https://github.com/RameshAditya/asciify/blob/master/github-resources/sample.gif)

## 内容
- [ASCIIFY 是什么](#what-asciify-is)
- [ASCIIFY 是怎么工作的](#how-asciify-works)
- [怎么使用 ASCIIFY](#how-to-use-asciify)
- [未来的计划](#future-plans)
- [赞助我](#support-me)

## ASCIIFY 是什么
ASCIIFY 是一个可以读取一张图片并返回这张图片的文本格式的python脚本。简单来说,它可以用字符画出这张图片。

比如下面这张Octocat的图片 -
![](https://github.com/RameshAditya/asciify/blob/master/octocat.png)

它作为一个变量被传递给 ASCIIFY, 可以观察到下面的输出 -

```
....................................................................................................
....................................................................................................
.....................................####:...............####.......................................
.....................................#########################......................................
.....................................#########################......................................
.....................................########################.......................................
....................................###########################.....................................
...................................#############################....................................
...................................########?+?#######%++########....................................
...................................#####:::..::::::::::..::+####....................................
...................................####:::....::::::::.?..::####....................................
...................................####:::..?.::::::::?.?.::####....................................
...................................+###:::+??;::::::::???.::@###....................................
....................................###:::.??.::::::::.?..::###.....................................
.......................................###:::::::?::::::::###.......................................
........................................:####::::::::::@###.........................................
..................................###.......############............................................
..................................:,##.......@#######@..............................................
..................................:.##......###########.............................................
.....................................#:;....###########.............................................
......................................#@%#:S#####.#####@............................................
.......................................#######.##.######............................................
............................................##.##.######............................................
............................................##.##.######............................................
........................................::::##:##:######::::........................................
.....................................::::::###:##:###:###::::::.....................................
....................................,:::::::++##S::###++:::::::.....................................
.....................................:::::::++:++:++++++:::::::.....................................
.......................................:::::++:++:++++++:::::.......................................
..........................................::++:++:++++++::..........................................
..................................................,.................................................
....................................................................................................
```
-------------------------------------------------------------------------------------------------------
## ASCIIFY 是怎么工作的?
ASCIIFY 的原理很简单
下面是它使用的算法 -
- 将图片大小转换为一个标准的大小, 并且保持图片的比例
- 转换为灰阶(Grayscale)图片 (这么做的原因是 ASCIIFY 通过检验图片的灰阶度(intensity)来决定替换使用的字符)
- 创建一个将要用来替换的字符列表
- 通过检验和区分像素的灰阶度来将他们分组(使用 buckets 或 groups)
- 使用特定的字符替换掉同一个桶(bucket)里的像素
- 将获得的字符串打印到终端或保存到文件中
- 完成!

-------------------------------------------------------------------------------------------------------
## 如何使用 ASCIIFY
- 确保你给Python安装了 "PIL" 包(pip install pillow)
- Clone 这个 repo
- 运行这个python脚本,并将图像的路径作为参数传给它
- 脚本会将输出打印到终端,同时会将输出写入到一个叫'img.txt'的文件,它会保存在脚本的相同目录下
- 完成!

-------------------------------------------------------------------------------------------------------
## 未来的计划
- 考虑将文本打印到图片上来实现彩色的输出

-------------------------------------------------------------------------------------------------------
## 赞助我
如果你喜欢这个项目,请给一个星! :star:

如果你还喜欢我的其他项目,记得关注我获取更多内容!:slightly_smiling_face: