Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Eddie Du
Transparency not working on my Mac. Help! [ reply ]  
2012-09-05 18:43
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:
http://i.imgur.com/TKVHr.png

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