From: "Daniel P. Zepeda" Date: 2002-01-07T13:45:35+09:00 Subject: [ruby-talk:30433] Re: how do I "pop up" a scaled jpg image On Mon, 7 Jan 2002 12:16:58 +0900 Bil Kleb wrote: > So I created a small script (I welcome criticism) to > help me add some captions for a bunch of jpeg images: > > Dir["*.jpg"].sort.each do |file| > puts "Enter caption for #{file}:" > caption = gets > if caption && caption!="\n" then > File.open(File.basename(file,".jpg")+".txt","w") do |file| > file.puts caption > end > end > end > > However, it would be nice to have the script pop up a small > version of the image to look at while I write the caption. > > I've looked at Ruby-gimp, but I can't find any simple > examples or read Japanese. Any suggestions? > > (I'm on a linux box with things like Gimp and ImageMagick.) Here's a quick-and-dirty solution, it isn't pretty but it should get you going (display is a part of ImageMagick): #!/usr/bin/env ruby Dir["*.jpg"].sort.each do |file| Thread.start do `display #{file}` end puts "Enter caption for #{file}:" caption = gets if caption && caption!="\n" then File.open(File.basename(file,".jpg")+".txt","w") do |file| file.puts caption end end end > > Thanks, > -- > Bil > NASA Langley Research Center > Hampton, Virginia -- Daniel P. Zepeda daniel@zepeda-zone.net