ウェブ上から画像を取得してRMagickで変換してRuby/Tkで表示する

#!/usr/bin/env ruby
# coding: utf-8

require "rubygems"
require "tk"
require "tkextlib/tkimg/png"
require "open-uri"
require "rmagick"

width = height = 45
icon = "http://a0.twimg.com/profile_images/1182392304/bakeneko.png" 

image = Magick::Image.read(open(icon).to_path).first
image.resize_to_fill!(width, height)

TkLabel.new {
  image TkPhotoImage.new(:data => Tk::BinaryString(image.to_blob))
  pack
}

Tk.mainloop