本文整理汇总了C#中ImageMagick.MagickImage.SepiaTone方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.SepiaTone方法的具体用法?C# MagickImage.SepiaTone怎么用?C# MagickImage.SepiaTone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.SepiaTone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
{
var conf = new EffectViewModel(configData);
dest = Path.Combine(Path.GetDirectoryName(dest), Path.GetFileNameWithoutExtension(dest) + ".jpg");
using (MagickImage image = new MagickImage(infile))
{
switch (conf.SelectedMode)
{
case 0:
image.SepiaTone(new Percentage(conf.Param1));
break;
case 1:
image.OilPaint(conf.Param1,0.1);
break;
case 2:
image.Sketch();
break;
case 3:
image.Charcoal();
break;
case 4:
image.Solarize();
break;
case 5:
image.Swirl(conf.Param1);
break;
case 6:
image.Wave(PixelInterpolateMethod.Bilinear, conf.Param1, conf.Param2);
break;
case 7:
image.BlueShift();
break;
case 8:
image.RotationalBlur(conf.Param1);
break;
case 9:
image.Raise(conf.Param1);
break;
case 10:
image.Negate();
break;
case 11:
image.ColorSpace = ColorSpace.Gray;
break;
}
image.Format = MagickFormat.Jpeg;
image.Write(dest);
}
return dest;
}
示例2: ExecuteSepiaTone
private void ExecuteSepiaTone(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
arguments[attribute.Name] = Variables.GetValue<Percentage>(attribute);
}
if (arguments.Count == 0)
image.SepiaTone();
else if (OnlyContains(arguments, "threshold"))
image.SepiaTone((Percentage)arguments["threshold"]);
else
throw new ArgumentException("Invalid argument combination for 'sepiaTone', allowed combinations are: [] [threshold]");
}
示例3: Test_SepiaTone
public void Test_SepiaTone()
{
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.SepiaTone();
#if Q8
ColorAssert.AreEqual(new MagickColor("#472400"), image, 243, 45);
ColorAssert.AreEqual(new MagickColor("#522e00"), image, 394, 394);
ColorAssert.AreEqual(new MagickColor("#e4bb7c"), image, 477, 373);
#elif Q16
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#45be23e80000", "#475f24bf0000")), image, 243, 45);
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#50852d680000", "#52672e770000")), image, 394, 394);
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#e273b8c17a35", "#e5adbb627bf2")), image, 477, 373);
#elif Q16HDRI
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#45be23e90001", "#475f24bf0000")), image, 243, 45);
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#50862d690001", "#52672e770000")), image, 394, 394);
ColorAssert.AreEqual(new MagickColor(OpenCLValue.Get("#e274b8c17a35", "#e5adbb627bf2")), image, 477, 373);
#else
#error Not implemented!
#endif
}
}