RMagick: Setting opacity on a png that already has transparent elements <p>I need to compose images in rmagick. If I put a png that has transparent regions on another image and set the opacity of that png to 50% the parts that where transparent become white (with 50% opacity). But I want these regions to stay transparent.</p> <p>Here's my code:</p> <pre><code>canvas = Magick::Image.new(1024,768) canvas.opacity = Magick::MaxRGB image = Magick::ImageList.new('/tmp/trans.png').first image.background_color = "none" image.opacity = Magick::MaxRGB/2 canvas.composite!(image, 50, 50, Magick::OverCompositeOp) canvas.write('/tmp/composite.png') </code></pre> <p>Any suggestions?</p>