How to apply a mask with transparent background? #876
-
|
I am trying to take an image and fade the edges. What I have done is created an elliptical gradient (black in the center and white on the edges). I have tried many things nothing seems to be working. I was able to get this once but it was on the The below creates a 100% transparent image and places it on the final image so basically the image disappears. I have tried using var image = new MagickImage("images/background.png");
var boat = new MagickImage("images/boat.png");
var mask = new MagickImage("images/mask.png");
// Create the masked image
var maskedImage = new MagickImage(MagickColors.Transparent, boat.Width, boat.Height);
maskedImage.SetWriteMask(mask);
maskedImage.Composite(boat, Channels.RGB | Channels.Alpha);
// I have tried removing the mask at this point
// Add the masked image to the final image
image.Composite(maskedImage, Gravity.Center, CompositeOperator.Overlay, Channels.RGB);
// I have tried removing the mask at this point
image.Write("out.png"); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
|
Have you tried removing the write mask from |
Beta Was this translation helpful? Give feedback.



Have you tried removing the write mask from
layerImage? And is it possible to make your code sample smaller and include some test images?