private static void TransformFrame(IBitmapProcessor bitmapProcessor, ImageFrame frame) { var bitmapCopy = (Bitmap)frame.Bitmap.Clone(); frame.Bitmap.Dispose(); frame.Bitmap = bitmapProcessor.Process(bitmapCopy, frame.GetBackgroundColor().Color); DefaultQuantizer.Quantize(frame.Bitmap, frame.GetPalette()); frame.ImageDescriptor.ImageWidth = (short)frame.Bitmap.Width; frame.ImageDescriptor.ImageHeight = (short)frame.Bitmap.Height; }