Scaling Images with RMagick

August 27, 2006

Very early this morning, inspired by an article on the Philippines Ruby Users Group mailing list, I started experimenting with RMagick, a Ruby programming interface to Imagemagick, an open source image manipulation toolkit. Using a slightly modified version of the image scaling script from the article, I was able to reduce all of my bloated Philippines travel photos to one quarter of their original size.

I encountered two minor obstacles in trying to run the script:

  • Installing the RMagick gem before Imagemagick. I used RubyGems to install the RMagick gem, but after my first attempt, I quickly learned that RMagick requires the Imagemagick package and its various library dependencies. Without these, the RMagick native extensions fail to compile. After successfully installing Imagemagick, my second attempt to install RMagick again failed because, as the RMagick configuration log file (config.log) reported, I was missing the freetype font library. After installing freetype, my RMagick installation completed successfully.
  • Loading the RMagick gem. To get the Ruby interpreter to load the gem, the script must include the line requires 'rubygems'; you must specify -r rubygems on the Ruby command line, or you must assign string rubygems to environment variable RUBYOPT. The RubyGems User Guide explains in detail how to use one of these three environment options.
Once I managed to overcome these obstacles, I wrote a one line Bash script to apply the image scaling Ruby script to my images:

for file in Photos/Travel/Philippines/*.JPG; do sudo -u apache ./reduce_photo.rb $file; done

Et voila! Smaller Philippines photos!

Ship It!

August 23, 2006

A few weeks ago, I finished reading Ship It! A Practical Guide to Successful Software Projects from The Pragmatic Programmers. Drawn from the authors’ numerous years of experience developing software at SAS Software, Ship It! is a book full of advice, tips, and techniques that can help managers and developers alike improve their software development process. The book examines software development from three interrelated perspectives: infrastructure, techniques, and process. In particular, it discusses the iterative and agile Tracer Bullet software development process.

Two important lessons that I learned from Ship It! is that I should perform more code reviews and automated testing!

Other Ship It! reviews:

Google Reader Getting Better

August 15, 2006

Google Reader has improved considerably since I last used the blog reader and aggregator several months ago. Google Reader is a lot like Rojo, but much more responsive. Like Rojo, Reader does a fine job of weaving together (or aggregating) multiple feeds, interleaving their posts into a single virtual feed. I also like how Google Reader and Rojo both allow you to tag a feed with multiple labels. Contrast this with Bloglines, which still uses an antiquated and oh-so-Web-1.0 (or un-Web-2.0) folder hierarchy to organize feeds.

Google Reader, like Bloglines, has a handy set of keyboard shortcuts to help you more quickly navigate through articles and feeds and its menu items at the top of the page allow you to filter your reading list. Though Reader and Bloglines both have a ‘Keep Unread’ checkbox to allow you to preserve the unread status of an article, unlike Reader, Blogines provides no means for reading those flagged articles without also ‘reading’ newly unread articles. (This is one of my biggest Bloglines pet-peeves.) Like Rojo, Google Reader provides a ‘Star’ flag which also marks an article for later re-reading, but unlike ‘Keep Unread’, does not mark the article as permanently unread. The behaviour is subtly different, but there is an obvious overlap between the two flags, so I’m not too sure why Reader provides both. Nevertheless, Google Reader, like Rojo, makes reading previously read articles and articles of particular interest, much easier than does Bloglines.

One standard feature that is missing from Google Reader, but that most readers share, is the prominent display of feed subscriptions along with the number of unread articles in that feed. Unfortunately, since Google Reader doesn’t give you an ‘at-a-glance’ feed summary, you must randomly pick feeds to find out which ones have unread articles. This is a pain.

Google Reader can also improve in its responsiveness and useability. Though quicker than Rojo in loading and displaying articles, it still doesn’t come close to Bloglines, which is very fast. Navigating articles in Google Reader, though made easier with the keyboard shortcuts, is still awkward and imprecise. Jumping to the next article with the j key should jump immediately to the next article without delay, but instead, can sometimes leave you between articles, which is odd.

Despite Google Reader’s weaknesses, it has improved considerably and like Gmail, should continue to improve with time.

To switch between Rojo, Bloglines, or Google Reader (or use them all), all readers allow you to export and import your feed list as an Outline Processor Markup Language (OPML) file.

My Podcast Playlist

August 6, 2006

About three months ago, I bought a Sandisk Sansa audio player and since then I’ve become an avid listener of mostly science and technology related podcasts. My favourites of these are IT Conversations, Agile Toolkit, and Quirks and Quarks.

Closing Night at Cinema du Parc

August 3, 2006

Tonight was Cinema du Parc’s closing night. To celebrate CDP’s five years in business and to enjoy one last week of repertory movies, Desiree and I have seen six movies at the CDP since last Friday:

Tonight we had also wanted to see Eraserhead, their last show of the evening (and forever), but unfortunately, by the time we got there, it was sold out.

Despite this last disappointment, I was mostly pleased with the movies that we did get to see. Of these, I particularly enjoyed Amores Perros and Girl With a Pearl Earring, but was unimpressed with Lost in Translation. Coincidentally, Scarlett Johannson played in both Girl With a Pearl Earring and Lost in Translation. Though it had its humorous moments, Lost in Translation had a dull and mostly pointless story in which Bill Murray and Scarlett Johannson were a very unlikely and mismatched pair. Girl With a Pearl Earring was a much more interesting film for which Johannson was a perfect fit.