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

New Post: Issue with composited png

$
0
0
It seems that the Composite method changes the Depth of your image to 16 bit instead of the 8 bit of the original. Pngout.exe might not support 16-bit images. You can force a bit depth of 8 with the Depth property. You could also decide to force the writer to use the PNG24 format, this will get rid of the alpha channel but you might not notice the difference.
using (MagickImage background = new MagickImage(new MagickColor("yellow"), 500, 400))
{
  MagickImage foregroundImage = new MagickImage(@"C:\christmas.png");
  foregroundImage.Resize(400, 300);
  background.Composite(foregroundImage, 0, 0, CompositeOperator.Src);

  if (NoNeedAlpha)
    background.Write(@"PNG24:C:\christmas-45kb.png");
  else
  {
    background.Depth = 8;
    background.Write(@":C:\christmas-50kb.png");
  }
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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