yangkunlun 2019-06-28
ASCIIPlayer是一个基于Image2ASCII的ASCII码播放器,可以播放图片,gif动图,视屏(还在开发中)等,提供了类库和命令行工具方便使用。
HomePage: https://github.com/qeesung/as... 欢迎Star
先上一个效果图

然后将转换以后的ASCII图片输出到不同的IO中去,其中包括:
+---------------+ +---------+
| | | |
+------> Gif Decoder | +---> Encoder +---> file
| | | | | |
| +---------------+ | +---------+
| +---------------+ +-------------+ | +---------+
| | | | | | | |
Input File+------> Image Decoder +---> Frames +-->+ Image2ASCII +->ASCII Frames-+---> Player +---> stdout
| | | | | | | |
| +---------------+ +-------------+ | +---------+
| +---------------+ | +---------+
| | | | | |
+------> Video Decoder | +---> Server +---> socket
| | | |
+---------------+ +---------+go get -u github.com/qeesung/asciiplayer
_ ____ ____ ___ ___ ____ _ _ __ _______ ____ / \ / ___| / ___|_ _|_ _| _ \| | / \\ \ / / ____| _ \ / _ \ \___ \| | | | | || |_) | | / _ \\ V /| _| | |_) | / ___ \ ___) | |___ | | | || __/| |___ / ___ \| | | |___| _ < /_/ \_\____/ \____|___|___|_| |_____/_/ \_\_| |_____|_| \_\ >>>Version : 1.0.0 >>>Author : qeesung >>>HomePage : https://github.com/qeesung/asciiplayer asciiplayer is a library that can convert gif and video to ASCII image and provide the cli for easy use. Usage: asciiplayer [command] Available Commands: encode Encode gif or video to ascii gif or video help Help about any command play Play the gif and video in ASCII mode server Server command setup a http share server version Show the version Flags: -D, --debug Switch log level to DEBUG mode -h, --help help for asciiplayer Use "asciiplayer [command] --help" for more information about a command.
播放命令直接在终端中播放对应的媒体,比如PNG和GIF图片。
可以通过asciiplayer play -h来获得更多细节

通过适配屏幕的方式播放GIF
asciiplayer play demo.gif
缩小为原来的十分之一,然后播放GIF
asciiplayer play demo.gif -r 0.1
缩放成固定的长和宽,然后播放GIF
asciiplayer play demo.gif -w 100 -h 40
播放一个PNG图片
asciiplayer play demo.png
编码命令可以将一个PNG图片或者是GIF动图,视屏文件转化成一个ASCII的文件
可以运行asciiplayer encode -h来获得更多细节

输入文件eye.gif

输出文件ascii_eye.gif

讲一个GIF文件demo.gif编码为ASCII的Gif文件output.gif
asciiplayer encode demo.gif -o output.gif
指定输出ASCII字符大小的情况下,讲一个GIF文件demo.gif编码成ASCII的GIF动图文件output.gif
asciiplayer encode demo.gif -o output.gif --font_size=5
将GIF动图demo.gif缩放为原来的十分之一,然后编码成ASCII的GIF动图文件output.gif
asciiplayer encode demo.gif -o output.gif -r 0.1
编码一个jpeg文件,然后输出一个ASCII的output.png文件
asciiplayer encode demo.jpeg -o output.png
可以搭建一个Http Server,然后将转换以后的图片分享到远端的客户端。
搭建服务
$ asciiplayer server demo.gif # Server available on : http://0.0.0.0:8080
远端访问
$ curl http://hostname:8080 # play ascii image here
可以通过运行命令asciiplayer server --help来获得更多细节

输入demo.gif,并以默认端口8080启动一个http服务器
asciiplayer server demo.gif
输入demo.gif,并以自定义端口8888启动一个http服务器
asciiplayer server demo.gif --port 8888
输入一个demo.png图片,并且启动http 服务器
asciiplayer server demo.png
| Raw Image | ASCII Image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
HomePage: https://github.com/qeesung/as... 欢迎Star