Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: It seems that blur is doing something strange.

$
0
0
This looks like a bug in ImageMagick, I will investigate this for you. You can however make this method a bit simpler. If you start with a black background and you draw a white circle you won't need the alpha channel. It seems that is causing the issue.
privatestatic MagickImage CreateMask(int diameter)
{
  var mask = new MagickImage(Color.Black, diameter, diameter);
  mask.FillColor = new MagickColor(Color.White);
  mask.Draw(new DrawableCircle(diameter / 2.0, diameter / 2.0, diameter / 2.0, 0));
  mask.Blur(0, 1);
  return mask;
}
EDIT:

This is not a bug but caused by mask.Alpha(AlphaOption.Deactivate). When you create a transparent image this creates an image with pixels that have the following color: R=0, G=0, B=0, A=0. When you negate this the alpha channel won't be negated but it will turn the transparent pixels into the following color: R=65535, G=65535, B=65535, A=0. When you call mask.Alpha(AlphaOption.Deactivate) this will remove the alpha channel and change all the transparent pixels into the following color: R=65535, G=65535, B=65535. And because your non transparent pixels are white this will make the whole image white.

Viewing all articles
Browse latest Browse all 3693

Trending Articles