Skip to content

Commit

Permalink
Add README and .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
miaout17 committed Aug 27, 2011
1 parent 5fc3f4e commit 2eb2426
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
pkg/*
*.gem
.bundle
45 changes: 45 additions & 0 deletions README.md
@@ -0,0 +1,45 @@
# AnsiArt

This project is under refactoring.

Pending issues:

* Currently it only supports Ruby 1.9.2 or above because it uses `String#encode!`
* It requires `uming.ttc` font file in current working directory. This is inconvenient.

I saw there are some code to use `gd2` gem in ruby 1.8.x. I think that doesn't work.

## Requirement

* Ruby 1.9.2 or above
* libgd

## Installation

It's not on rubygems.org yet. Just clone the git reposiory and execute.

rake install

## Example: Get it working

Put a `uming.tcc` font file in your working directory.
In Ubuntu it might be at `/usr/share/fonts/truetype/arphic/uming.ttc`.

Download a ansi file:

wget http://ansi.loli.tw/ansiarts/static/803.ans

And here is the ruby snippet:

require 'rubygems'
gem 'ansi_art'
require 'ansi_art'

c = AnsiArt::Document.new(IO.read('803.ans'))
html = c.to_html
File.open('out.html', 'w') { |f| f.write(html) }
png = c.to_png
File.open('out.png', 'wb') { |f| f.write(png) }

You should see `out.html` and `out.png` in your working directory.

0 comments on commit 2eb2426

Please sign in to comment.