Archive for January, 2010

Twitter reactions to the iPad

Wednesday, January 27th, 2010

Since the announcement a few hours ago:

Twitter stream

The Intern

Monday, January 25th, 2010

Rufus has been helping out around the home office: providing moral support, slobbering on pant legs, and conducting some thought-leadership workshops (read: napping for hours on end). He’s a real team player.

Fiori di Como

Sunday, January 24th, 2010

Dale Chihuly:

I’m amazed at what people find in my work, and I don’t like to limit what you see with a title. For me titles are very difficult, and I don’t usually even think in terms of a theme when I’m creating a sculpture. Once it’s finished I’ll come up with a title, but one person might see flowers, another something from the sea or something from a dream. Bellagio was inspired by the hotel on Lake Como, and I wanted to use the lake in the title – it’s so romantic. I used the word fiori (flowers), but everybody sees something different.

HOWTO: Watermarking Images with ImageMagick and attachment_fu

Thursday, January 14th, 2010

While working on a project for the State Hermitage Museum last year, I had to implement some image watermarking. The basic requirement was that for a certain type of uploaded image, its largest thumbnail should have the museum’s logo tiled across it. I was using attachment_fu to handle the image upload, and ImageMagick/RMagick to process the thumbnails.

After some cursory Googling, I found the ImageMagick Annotating guide, which had this sample watermark command:

 $ convert overlay.png  -fill grey50 -colorize 40  miff:- |\
    composite -dissolve 15 -tile  -  original.jpg watermarked_image.jpg

The dissection of the command:

overlay.png: The source image to overlay

-fill grey50 -colorize 40: Alter the colors of the watermark file

composite: command to overlay the watermark

-dissolve 15 -tile: “dissolve” the overlay at 15%, for good transparency, and tile (repeat) the watermark over the source image.

That’s simple enough, and with these source files:

overlay.png

and dearest Rufus:

rufus.jpg

rufus.jpg

 $ convert overlay.png -fill grey50 -colorize 40 miff:- |\
    composite -dissolve 15 -tile - rufus.jpg result-15.jpg

Produces:

Overlay with 15% dissolve

convert overlay.png -fill grey50 -colorize 40 miff:- |\
  composite -dissolve 50 -tile - rufus.jpg result-50.jpg

Overlay with 50% dissolve

Unfortunately, RMagick’s watermark method doesn’t support tiling. To work around, I had to call the composite_tiled! method on a colorized image. This code is in my Thumbnail model, which includes attachment_fu:

class Thumbnail < ActiveRecord::Base
  has_attachment  :content_type => :image,
   # some settings omitted
   :watermark_overlay => File.join(RAILS_ROOT, '/public/images/watermark-overlay-image.png'),
   :watermarkable_size => "1500>" 
 
  after_attachment_saved do |record|
    if record.respond_to?(:parent_id) and record.parent_id.nil? # the original image, not the smaller thumbnails
      with_image record.full_filename do |img|
        img.composite_tiled!(
          Magick::ImageList.new(attachment_options[:watermark_overlay]).first.colorize(0.4, 0.4, 0.4, 'grey'),   # process and colorize image
          Magick::SoftLightCompositeOp)
        img.write record.full_filename  # save image
      end
    end
  end
end

Now every Thumbnail record will automatically have a watermarked large image.

Gordie, Pretty Bird

Friday, January 8th, 2010

This is Gordie, the Gansen family pet bird. He’s been around since 1997, making him 12 years old. Words cannot express how much I love this little guy.

He loves nothing more than to run around and chase pieces of paper. If you tap on the paper, the following will happen:

And sometimes he gets a bit overstimulated and decides to bite everyone, then it’s time to hang out in the cage:

Oh, Gordie. happy new year to you.