Transparency not working on my Mac. Help!

Here's some code to overlay a transparent square over a blue background
- at least I think it should do this.

I'm on OSX 10.7.3, ruby 1.9.3p125, RMagick 2.13.1, ImageMagick 6.7.5-7

Code:

···

###########################
require 'RMagick'

bg = Magick::Image.new(400, 400) {
  self.background_color = 'blue'
}

sq = Magick::Image.new(200, 200) {
  self.background_color = 'none'
}

bg.composite!(sq, 0, 0, Magick::OverCompositeOp)

bg.write('out.png')
###########################

Here's my output (The square is not transparent, it's completely black):

Does this happen to you? Any idea what's going on?

--
Posted via http://www.ruby-forum.com/.

It works correctly for me on Windows XP, ruby 1.9.3p0 (2011-10-30)
[i386-mingw32], RMagick 2.13.1, ImageMagick 6.7.5-10 Q16.

-- Matma Rex

I realized that sq.alpha was turned off. I turned it on with
sq.alpha(Magick::ActivateAlphaChannel) and it worked :slight_smile:

See http://www.imagemagick.org/RMagick/doc/image1.html#alpha

···

--
Posted via http://www.ruby-forum.com/.