I find that Italy is a target-rich environment for taking pictures and
I'm taking lots. I need to resize the pics (make them smaller, like 320X240)
so I can put them on the web. Doing this by hand with iPhoto is a bit of
a pain. Can anyone suggest a way of doing this using a Ruby script?
I find that Italy is a target-rich environment for taking pictures and I'm taking lots. I need to resize the pics (make them smaller, like 320X240) so I can put them on the web. Doing this by hand with iPhoto is a bit of a pain. Can anyone suggest a way of doing this using a Ruby script?
Thanks.
Phil
As you're using a Macintosh you could look at sips, which is installed by default - just type sips --help, which allows all sorts of image manipulation such as --resampleHeightWidth pixelsH pixelsW.
You mention iPhoto, so I'll take that as a sign that you are a Mac OS X
user. But in case ruby-gtk2 and RMagick can be loaded on such a system
or in case others may be interested...
I have been working on a little application I call WebGal--a gtk2-based
GUI tool for creating web galleries. WebGal has functions for adding and
removing images from a gallery, rotating source image files, titling,
dating, captioning, and making notes on images. Right now it's still
getting its legs, but it does the basic job just fine (standard caveats
related to development software apply).
Using extremely simple templates and CSS, WebGal will create all the
necessary files so that you have a working HTML web gallery, complete
with a thumbnail index page and easy navigate from one image to the next
within the gallery.
Settings are available to indicate the size of thumbnails and final
display images.
On Mon, 2004-12-20 at 18:22 +0900, Phil Tomson wrote:
I find that Italy is a target-rich environment for taking pictures and
I'm taking lots. I need to resize the pics (make them smaller, like 320X240)
so I can put them on the web. Doing this by hand with iPhoto is a bit of
a pain. Can anyone suggest a way of doing this using a Ruby script?
I'm working on some RMagick-based web gallery code right now, as I know
several people (myself included) who want to set up 'photo-a-day'
blogs. Unfortunately, with all the holiday craziness, I haven't had
time to do much more than tinker with it, but the basic code to do
resizing is pretty straightforward.
I found the later version of iPhoto to be better for this, but the
options were not necessarily where expected.
Unfortunately, I'm away from my Mac for the holidays, so I can't double check.
Nick
···
On Mon, 20 Dec 2004 18:22:07 +0900, Phil Tomson <ptkwt@aracnet.com> wrote:
I find that Italy is a target-rich environment for taking pictures and
I'm taking lots. I need to resize the pics (make them smaller, like 320X240)
so I can put them on the web. Doing this by hand with iPhoto is a bit of
a pain. Can anyone suggest a way of doing this using a Ruby script?
I use RMagick and have been very happy with it. Here's a snippet from the program that generates our family picture website. The "640" code just scales the picture to make sure it fits inside a 640x640 box (so one dimension is == 640 and the other is <= 640), and the "thumb" code makes sure the new image is 160x120, filling with white any area not covered by a photo of a different aspect ratio. (Since there are many thumbnails on a page, I wanted them to be all the same size.) You're welcome to check out our site (http://pine.fm), and tell me if you want any more of the code.
···
-----------
def makeImage (fileName, size)
if !FileTest.exist?('pictures/'+fileName)
# TODO: Error report?
return 'Cannot find picture "'+fileName+'".'
end
altText = if PICTURES[fileName]
PICTURES[fileName][:desc]
else
'This picture needs info.'
end
case size
when 640
#
# Make 640x640 image
#
smallFileName = 'pictures_640/640__' + fileName
if !FileTest.exist?(smallFileName)
image = Magick::ImageList.new('pictures/'+fileName)
image = image.change_geometry('640x640') do |cols, rows, img|
img.resize!(cols, rows)
end
image.write(smallFileName) { self.quality = 85 }
end
I use RMagick for my patch to instiki that resizes photos for display
as thumbnails. Its API is really spiffy, easy to use.
···
On Tue, 21 Dec 2004 03:59:09 +0900, Michael C. Libby <mcl-ruby-talk@andsoforth.com> wrote:
On Mon, 2004-12-20 at 18:22 +0900, Phil Tomson wrote:
> I find that Italy is a target-rich environment for taking pictures and
> I'm taking lots. I need to resize the pics (make them smaller, like 320X240)
> so I can put them on the web. Doing this by hand with iPhoto is a bit of
> a pain. Can anyone suggest a way of doing this using a Ruby script?