本文整理汇总了C#中ImageMagick.MagickImage.AutoGamma方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.AutoGamma方法的具体用法?C# MagickImage.AutoGamma怎么用?C# MagickImage.AutoGamma使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.AutoGamma方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
{
var conf = new EnhanceViewModel(configData);
dest = Path.Combine(Path.GetDirectoryName(dest), Path.GetFileNameWithoutExtension(dest) + ".jpg");
using (MagickImage image = new MagickImage(infile))
{
if (conf.Normalize)
image.Normalize();
if (conf.AutoGamma)
image.AutoGamma();
image.BrightnessContrast(new Percentage(conf.Brightness), new Percentage(conf.Contrast));
if (conf.SContrast > 0)
image.SigmoidalContrast(true, conf.SContrast);
if (conf.Edge)
image.AdaptiveSharpen();
if (conf.Sharpen > 0)
image.UnsharpMask(1.5, 1.5, conf.Sharpen/100.0, 0.2);
image.Format = MagickFormat.Jpeg;
image.Write(dest);
}
return dest;
}
示例2: ExecuteAutoGamma
private void ExecuteAutoGamma(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
arguments[attribute.Name] = Variables.GetValue<Channels>(attribute);
}
if (arguments.Count == 0)
image.AutoGamma();
else if (OnlyContains(arguments, "channels"))
image.AutoGamma((Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'autoGamma', allowed combinations are: [] [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_AutoGamma
public void Test_AutoGamma()
{
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.AutoGamma();
ColorAssert.AreEqual(new MagickColor("#00000003017E"), image, 496, 429);
}
}