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

New Post: Using Magick.NET for making PNG background transparent

$
0
0
That is possible and your command would translate to this:
using (MagickImage image = new MagickImage("wizard:")) // [inputfile]
{
  MagickImage green;

  using (MagickImage first = image.Clone()) // +clone
  {
    first.ColorSpace = ColorSpace.HSB; // -colorspace HSB
    green = first.Separate(Channels.Green).First(); // -channel Saturation -separate
  }

  MagickImage blue;

  using (MagickImage second = image.Clone()) // -clone 0
  {
    second.ColorSpace = ColorSpace.HWB; // -colorspace HWB
    blue = second.Separate(Channels.Blue).First(); // -channel B -separate
  }

  // ( -clone 1-2 -compose plus -composite ) -delete 1-2//// You don't need to clone green and blue in Magick.NET, you can just// use the green image and dispose the blue image.
  green.Composite(blue, CompositeOperator.Plus);
  blue.Dispose();

  image.Composite(green, CompositeOperator.CopyAlpha); // -compose CopyOpacity -composite 
  green.Dispose() // clean up the green image.

  image.Modulate(new Percentage(100), new Percentage(2000)); // -modulate 100,2000
  image.Level(new Percentage(99), new Percentage(100)); // -level 99%,100%

  image.Write("wizard.png"); // [outputfile] 
}
If one of the translations is not clear to you then feel free to ask

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>