2006-12-01 @ 16:04

Resizing Animated Gif's with RMagick

I needed to resize some animated gif’s using RMagick, and the solutions I found on the web didn’t work for me, so I thought I would post what I did. The best solution I found was here using FileColumn. Unfortunately it didn’t work out for me. That particular solution assumed that all frames were the same dimension, and that isn’t the case for me. I found that if I scaled down all the frames, the image would come out looking right.

Here is what I came up with:

File.open(ARGV[0], 'rb') { |file|
  imgs = Magick::ImageList.new
  imgs.from_blob file.read

  # Find the largest frame
  largest = imgs.map {|i| i.columns }.max

  percentage = 50.0 / largest
  imgs.each { |img| img.scale!(percentage) }

  File.open(ARGV[1], 'wb') { |f| f.write imgs.to_blob }

Basically the idea is to find the largest frame, from that frame calculate the scale percentage, and scale each frame. It isn’t perfect because frames could scale differently, but it seems to work for what I’m doing.

read more »

2006-12-02 @ 15:41

Tender Thanksgiving Photos

I finally posted my Thanksgiving photos on flickr here. Highlights include White Taco, and her baby Ernesta:

White Taco, BitchesIMG_0133.JPG

I cooked a Turkey using Alton Brown’s Recipe, and it tasted amazing. It was so good that I tenderly ate it up. Stacy made some awesome mashed potatoes, excellent cranberry sauce and great stuffing. Heather brought the best cherry pie I’ve had in a long time. I think Thanksgiving is one of my favorite holidays because you get to eat really good food. I also get to eat really good leftovers the week after!

Thanks for coming everyone, it was amazing! Be sure to check out White Taco’s Thanksgiving video.

read more »