アスキーアートの画像化

http://howdyworld.org/junk/aa.html
http://howdyworld.org/junk/aa.html

30分プログラム、その237。AAの画像化。
とりあえずCGI化した。一部ブラウザでは使えない予感。

ソースコード

#! /usr/bin/env ruby
# -*- mode:ruby; coding:utf-8 -*-
#
# aa.rb -
#
# Copyright(C) 2008 by mzp
# Author: MIZUNO Hiroki / mzpppp at gmail dot com
# http://howdyworld.org
#
# Timestamp: 2008/02/06 23:14:22
#
# This program is free software; you can redistribute it and/or
# modify it under MIT Lincence.
#

require 'kconv'
require 'cgi'

cgi = CGI.new

size = cgi['s'].to_i
size = 10 if size == 0

value = shellescape(cgi['v'])

cgi.out('image/png'){
  %x(convert -pointsize #{size} -font ./ipagp-mona.ttf label:"#{value}" png:-)
}