本文整理汇总了C#中ImageMagick.MagickImage.Negate方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Negate方法的具体用法?C# MagickImage.Negate怎么用?C# MagickImage.Negate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.Negate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ExecuteNegate
private void ExecuteNegate(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 == "onlyGrayscale")
arguments["onlyGrayscale"] = Variables.GetValue<Boolean>(attribute);
}
if (arguments.Count == 0)
image.Negate();
else if (OnlyContains(arguments, "channels"))
image.Negate((Channels)arguments["channels"]);
else if (OnlyContains(arguments, "onlyGrayscale"))
image.Negate((Boolean)arguments["onlyGrayscale"]);
else if (OnlyContains(arguments, "onlyGrayscale", "channels"))
image.Negate((Boolean)arguments["onlyGrayscale"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'negate', allowed combinations are: [] [channels] [onlyGrayscale] [onlyGrayscale, channels]");
}
示例3: processImgForScanning
private Bitmap processImgForScanning(Bitmap imgInput)
{
using (MemoryStream memstream = new MemoryStream())
{
imgInput.Save(memstream, ImageFormat.Tiff);
MagickImage img = new MagickImage(memstream.ToArray());
if (sharpen)
{
img.Sharpen((int)sharpenIntX.Value, (int)sharpenIntY.Value, Channels.All);
}
if (autoGamma)
{
img.AutoGamma();
}
if (enhance)
{
img.Enhance();
}
if (contrast)
{
img.Contrast();
}
if (autoLevel)
{
img.AutoLevel();
}
if (autoOrient)
{
img.AutoOrient();
}
if (despeckle)
{
img.Despeckle();
}
if (medianFilter)
{
img.MedianFilter((int)medianInt.Value);
}
if (unsharpmask)
{
img.Unsharpmask(6.8, 4, 4,0);
}
if (wtThreshold)
{
img.LinearStretch((float)0.9, 0.1);
//img.WhiteThreshold((int)wtThresInt.Value);
//img.ReduceNoise();
//img.Grayscale(PixelIntensityMethod.Brightness);
}
if (invert)
{
img.Negate();
}
return img.ToBitmap();
}
}
示例4: Test_CannyEdge_HoughLine
public void Test_CannyEdge_HoughLine()
{
using (MagickImage image = new MagickImage(Files.ConnectedComponentsPNG))
{
image.Threshold(new Percentage(50));
ColorAssert.AreEqual(MagickColors.Black, image, 150, 365);
image.Negate();
ColorAssert.AreEqual(MagickColors.White, image, 150, 365);
image.CannyEdge();
ColorAssert.AreEqual(MagickColors.Black, image, 150, 365);
image.Crop(260, 180, 215, 200);
image.Settings.FillColor = MagickColors.Red;
image.Settings.StrokeColor = MagickColors.Red;
image.HoughLine();
ColorAssert.AreEqual(MagickColors.Red, image, 105, 25);
}
}