| 2008-06-10 05:48:27 | Ответить |
|---|---|
|
Dracula Адрес: Сообщений: 23 Регистр: 2008-05-31 его блог 0 сообщ. |
RE: Ruby CGI и Watermark |
|
Ruby/GD (formerly known as "GD") is an extension library to use the gd library from Ruby.
http://rubyforge.org/projects/ruby-gd/ Alternative Ruby/GD2 ftp://ftp.mars.org/pub/ruby/ruby-gd2-0.1.tar.gz Пример: include GD2 image = File.open('image.png') { |f| Image.load(f) } image.resize! 200, 300 image.draw do |pen| pen.color = image.palette.find! Color.new(1.0, 0.75, 0.5) pen.thickness = 2 pen.move_to 25, 50 pen.line_to 175, 50 pen.move -150, 25 pen.font = Font::TrueType.new('/usr/share/fonts/times.ttf', 20) pen.text 'Hello, world!' end File.open('new-image.png', 'w') { |f| f.write(image.png_data) } |
|
| gd, gd2, ruby |