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

New Post: Convert 32bit PNG to 8bit/128colors PNG

$
0
0
You are calling the wrong methods. You hardly ever need to use the SetDefine method.
using (MagickImage image = new MagickImage(origPATH))
{
  image.Format = MagickFormat.Png;

  //image.SetDefine(MagickFormat.Png, "colors", "128");
  QuantizeSettings settings = new QuantizeSettings();
  settings.Colors = 128;
  image.Quantize(settings);

  //image.SetDefine(MagickFormat.Png, "depth", "8");
  image.Depth = 8;

  //image.SetDefine(MagickFormat.Png, "resample", "72");
  image.Resample(72, 72);

  image.Write(targetPATH);
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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