From: "Bashar A. Asad" Date: 2001-12-27T12:11:08+09:00 Subject: [ruby-talk:29454] Re: imageMagick hello again, I tried to write the script that will read img file and create thumbs from the dir, and this is what I came up with but its not working, it spells out a parse error on n = no_ext(#{f}), what am I doing wrong? ---------------------------------------------------- require "magick" dir = "." def no_ext(n) r="#{n}" r.sub(/\.gif/,'') end def createThumbFile(f) img = Magick::Image.new(#{f}) img.scale('60%') n = no_ext(#{f}) img.write("filename"=>"#{n}_thumb.gif") end Dir.foreach(dir){|file| createThumbFile("file") } ----------------------------------------------------------- On Thursday 27 December 2001 04:26, you wrote: > hello, > I wrote a very small script that will take one image file and create a > thumb image for it. How can I make my script read all the image files in > the directory and create the thumbs? > > the script: > require "magick" > > #read file image.jpg > imagefile = Magick::Image.new("image.gif") > > #scaling the image > imaget = imagefile.dup > imaget.scale('60%') > > #writing out the thumb file > imaget.write("filename"=>"imagethumb.gif") > > > thanx