private void ExecutePosterize(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
if (attribute.Name == "channels")
arguments["channels"] = Variables.GetValue<Channels>(attribute);
else if (attribute.Name == "levels")
arguments["levels"] = Variables.GetValue<Int32>(attribute);
else if (attribute.Name == "method")
arguments["method"] = Variables.GetValue<DitherMethod>(attribute);
}
if (OnlyContains(arguments, "levels"))
image.Posterize((Int32)arguments["levels"]);
else if (OnlyContains(arguments, "levels", "channels"))
image.Posterize((Int32)arguments["levels"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "levels", "method"))
image.Posterize((Int32)arguments["levels"], (DitherMethod)arguments["method"]);
else if (OnlyContains(arguments, "levels", "method", "channels"))
image.Posterize((Int32)arguments["levels"], (DitherMethod)arguments["method"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'posterize', allowed combinations are: [levels] [levels, channels] [levels, method] [levels, method, channels]");
}
private static void ExecutePreserveColorType(MagickImage image)