From 46abf6f02b4b6f87d495d08f97fe8be3d5383f6d Mon Sep 17 00:00:00 2001 From: tomial Date: Tue, 1 Oct 2019 02:13:48 +0800 Subject: [PATCH] Add README in Simplified Chinese --- README_zh-CN.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 README_zh-CN.md diff --git a/README_zh-CN.md b/README_zh-CN.md new file mode 100644 index 0000000..f870e51 --- /dev/null +++ b/README_zh-CN.md @@ -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: