1 Star 0 Fork 0

ironny / ansize

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Ansize

Converts an image to binary ANSI art like so:

stage-pikachu.png

Check out the examples folder for some image samples and their corresponding output. Ex.

cat examples/pikachu.ansi

I optimized for images with dark backgrounds and used 0's and 1's for the character set but it's pretty easy to customize the code to convert to your liking! The basic strategy of conversion is very simple:

  1. Shrink image to desired size
  2. For each pixel, find the corresponding color in ANSI's limited color palette
  3. Set the foreground to that color
  4. Print a random 0 or 1

Installation

go get github.com/jhchen/ansize

Usage

ansize <image> <output> [width]

Development

  1. Install go
  2. Set your $GOPATH
  3. Install github.com/nfnt/resize
  4. Clone ansize
  5. Build ansize

On a Mac with Homebrew the commands are

brew install go
mkdir /usr/local/lib/go
export GOPATH=/usr/local/lib/go
go get github.com/nfnt/resize
git clone git@github.com:jhchen/ansize.git
go build ansize.go
The MIT License (MIT) Copyright (c) 2013 Jason Chen 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.

简介

Convert images to binary ANSI art 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/ironny04/ansize.git
git@gitee.com:ironny04/ansize.git
ironny04
ansize
ansize
master

搜索帮助