MORE ON IMAGE DISPLAY IN RUBY
Ruby is a free, open source, object-oriented programming language.
There are many beginner books on Ruby. If you work in the medical
or biological fields, you might want to try my book,
Ruby Programming for Medicine and Biology, which will be
published in the early fall, 2007, by Jones & Bartlett Publishers.
We have previously described
what you need to install to manipulate
images in Ruby (ImageMagick, RMagick, and Tcl/Tk).
Here is a short Ruby script that shows how to use RMagick (Ruby's
interface to ImageMagick) to create and display an image.
#!/usr/local/bin/ruby
require 'RMagick'
include Magick
f = Image.new(400,400) { self.background_color = "green" }
f.write("green.gif")
require 'tk'
root = TkRoot.new {title "view"}
TkButton.new(root) do
image TkPhotoImage.new{file "green.gif"}
command {exit}
pack
end
Tk.mainloop
exit
The script creates an green square and displays it in a Tk
window.