【Python AsciiArt】利用命令行打印出字符图案

您所在的位置:网站首页 符号拼凑的图案 【Python AsciiArt】利用命令行打印出字符图案

【Python AsciiArt】利用命令行打印出字符图案

2023-11-13 03:51| 来源: 网络整理| 查看: 265

利用字符串生成工具可以方便的打印出自己想要字符图案,以及如何将图片转换为ASCII ART输出。 最终可以用命令行输出各种彩色图像---->> 利用背景显示,参数48,占位符grays[-2]

一般字符图案

我们在使用一些开源软件的时候,启动打开的字符图形很好看。于是搜索到了一些工具来实现:

""" _ _ _ | | | | ( ) | | ___ | |_|/ ___ __ _ ___ | | / _ \ | __| / __| / _` | / _ \ | |____ | __/ | |_ \__ \ | (_| | | (_) | \_____/ \___| \__| |___/ \__, | \___/ __/ | |___/ """ 1.网站taag

在这里插入图片描述 可以随意输入内容,调节字体、宽、高。

同时作者还有另外一个ascii图形生成器:http://patorjk.com/arial-ascii-art

#一条小鳄鱼 # __ __ # _ _ /_@)_@) \ /^^\ /^\ /^^\_ # _/oo \____/~''. . . '~\ /'\'' ~ ''~~' -'\_ # / '.'. ~.~.~. .' ~ | /'\~~..''''.'' '' ~\_ # ('_'_'_'_'_'_'_'_ ' : ' \_/' '.'' . '. .'' '. ~\_ # ~V~V~V~V \ ~\ '' '~ ' '' ~ ` ~ '' ~\_ # /\~/\~/\~/\~/|/ ' '' _ ' ~ '' ' ~ '' __ ' .. \_ # > 48为背景 ,使用grays[-1/-2]输出 strline+= color_id #按行写入控制台 print(strline)

img_RGBcolor_ascii(img) 就可以愉快绘图了! 利用背景显示,参数48,占位符grays[-2]

在这里插入图片描述 pic from pexels.com

TODO

#https://en.wikipedia.org/wiki/ANSI_escape_code #opencv:https://docs.opencv.org/3.1.0/de/d25/imgproc_color_conversions.html def cvtRGB2ITU([r,g,b]): [r,g,b] = [r,g,b]/255*5 color_v = 16 + 36 × r + 6 × g + b return color_v def cvtRGB2ITU(color): #array combined [0, 95, 135, 175, 215, 255] find the region color = np.array(color)/40 color_v = color return color_v

ref: https://en.wikipedia.org/wiki/ASCII_art https://blog.csdn.net/qq_19655383/article/details/70176349 https://blog.csdn.net/su_bao/article/details/80355001 color: https://www.text-image.com/index.html https://www.maketecheasier.com/convert-pictures-ascii-art/ https://fossbytes.com/linux-distribution-logo-ascii-art-terminal/ https://gallery.technet.microsoft.com/scriptcenter/bc15444a-9490-4115-aa40-76d898041724 https://stackoverflow.com/questions/40754673/python-fails-to-output-ansi-color-codes-for-the-terminal https://en.wikipedia.org/wiki/8-bit_color changechar:https://www.geeksforgeeks.org/converting-image-ascii-image-python/ ++||| https://stackoverflow.com/questions/287871/print-in-terminal-with-colors modules: https://pypi.org/project/colorama/ https://pypi.org/project/termcolor/ ternima: https://unix.stackexchange.com/questions/404414/print-true-color-24-bit-test-pattern/404415#404415 ++YY$$ python:https://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal https://segmentfault.com/q/1010000016688755



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3