From: nobu.nokada@... Date: 2002-01-08T18:05:08+09:00 Subject: Re: how do I "pop up" a scaled jpg image At Tue, 8 Jan 2002 06:53:20 +0900, Neil Conway wrote: > > > So I created a small script (I welcome criticism) to > > > help me add some captions for a bunch of jpeg images: > > > > 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. > > > Here's a quick-and-dirty solution, it isn't pretty but it should > > get you going (display is a part of ImageMagick): > > > Thread.start do > > `display #{file}` > > end > > This is probably better: > > `display #{file} &` trap(:CHLD) {wait(-1, Process::WNOHANG)} Dir["*.jpg"].sort.each do |file| pid = fork {exec "display", file} begin 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 ensure Process.kill :TERM, pid end end # BTW, I want Process.spawn. -- Nobu Nakada