From: "Bashar A. Asad" Date: 2001-12-27T20:39:16+09:00 Subject: [ruby-talk:29470] Re: imageMagick hi, but this will create me only one image file, instead of one thumb image for every image in the dir as a separate file with different name. thanks bashar On Thursday 27 December 2001 07:21, you wrote: > Hi, > > At Thu, 27 Dec 2001 10:26:31 +0900, > > Bashar Asad 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") > > please try this for example: > > require 'magick' > > # create a null image object. > im_seq = Magick::Image.new > > # create a image sequence object which consists of > # all the GIF images(scaled at 60%) in the directory. > Dir.glob("/path/to/directory/*.gif") do |f| > im_seq.push Magick::Image.new(f).scale('60%') > end > > # create a thumbnail image. > # Images are arranged so that the thumbnail has 5 columns. > # Because ImageMagick automatically calculates > # the appropriate row size enough to draw all the images, > # I specified an arbitraly large rows. > thumbnail = im_seq.montage({'tile'=>'5x1000'}) > > # output > thumbnail.write('filename'=>'imagethumb.gif') > > The reference manual lacks the description for > some useful features of color and geometry specifications, > and montages options are merely listed without any > description. Following documents would be helpful. > Sorry for inconvinience. > > ImageMagick-5.x.x/www/color.html > ImageMagick-5.x.x/Magick++/Geometry.htm > ImageMagick-5.x.x/montage.html, or montage(1) > > > Regards, > > Ryuichi Tamura