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

New Post: What happens with Copyopacity in version 7

$
0
0
If I understand you corectly you want to copy the alpha channel from one image to the other image. I have just published Magick.NET 7.0.2.600 that has a new overload in CopyPixels that allows you to copy only the alpha channel. I think this will get you the result that you want:
publicvoid ConvertPictures()
{
  var cropImagePath = @"d:\temp\BlackWithSquare.png";
  var userSamplePicturePath = @"d:\temp\userSample.png";

  using (var userSamplePicture = new MagickImage(userSamplePicturePath))
  {
    using (var blackImage = new MagickImage(cropImagePath))
    {
      blackImage.Resize(userSamplePicture.Width, userSamplePicture.Height);
      userSamplePicture.CopyPixels(blackImage, Channels.Alpha);
      userSamplePicture.Write(@"d:\temp\test.png");
    }
  }
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles