// Standard public CWatchImage(string name, int index, IMagickImage magickImage, double metricUpperBound) { Name = name; Index = index; MagickImage = magickImage; HasAlpha = MagickImage != null && MagickImage.HasAlpha; TransparencyRate = MagickImage != null?MagickImage.GetTransparencyRate() : 0; AlphaChannel = null; MetricUpperBound = metricUpperBound; _PauseTicks = DateTime.MinValue.Ticks; if (HasAlpha) { // Does Separate() clone the channels? If so, does it dispose of them during this? var tmpMi = MagickImage.Separate().Last().Clone(); tmpMi.Negate(); AlphaChannel = new MagickImage(_AlphaReplacement, MagickImage.Width, MagickImage.Height); AlphaChannel.Composite(tmpMi, CompositeOperator.CopyAlpha); AlphaChannel.RePage(); tmpMi.Dispose(); MagickImage.ColorAlpha(_AlphaReplacement); MagickImage.RePage(); } }