当前位置: 首页>>代码示例>>C#>>正文


C# MagickImage.BrightnessContrast方法代码示例

本文整理汇总了C#中ImageMagick.MagickImage.BrightnessContrast方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.BrightnessContrast方法的具体用法?C# MagickImage.BrightnessContrast怎么用?C# MagickImage.BrightnessContrast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageMagick.MagickImage的用法示例。


在下文中一共展示了MagickImage.BrightnessContrast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:22,代码来源:Enhance.cs

示例2: ExecuteBrightnessContrast

 private void ExecuteBrightnessContrast(XmlElement element, MagickImage image)
 {
   Hashtable arguments = new Hashtable();
   foreach (XmlAttribute attribute in element.Attributes)
   {
     if (attribute.Name == "brightness")
       arguments["brightness"] = Variables.GetValue<Percentage>(attribute);
     else if (attribute.Name == "channels")
       arguments["channels"] = Variables.GetValue<Channels>(attribute);
     else if (attribute.Name == "contrast")
       arguments["contrast"] = Variables.GetValue<Percentage>(attribute);
   }
   if (OnlyContains(arguments, "brightness", "contrast"))
     image.BrightnessContrast((Percentage)arguments["brightness"], (Percentage)arguments["contrast"]);
   else if (OnlyContains(arguments, "brightness", "contrast", "channels"))
     image.BrightnessContrast((Percentage)arguments["brightness"], (Percentage)arguments["contrast"], (Channels)arguments["channels"]);
   else
     throw new ArgumentException("Invalid argument combination for 'brightnessContrast', allowed combinations are: [brightness, contrast] [brightness, contrast, channels]");
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:19,代码来源:MagickImage.cs

示例3: OverrideTextureMaps

        public bool OverrideTextureMaps(string textureName, double reflection, double blur, double specular) {
            using (var image = new MagickImage(Kn5.TexturesData[textureName])) {
                if (image.Width > 512 || image.Height > 512) {
                    image.Resize(512, 512);
                }

                image.BrightnessContrast(reflection, 1d, Channels.Red);
                image.BrightnessContrast(blur, 1d, Channels.Green);
                image.BrightnessContrast(specular, 1d, Channels.Blue);

                return OverrideTexture(textureName, image.ToByteArray(MagickFormat.Bmp));
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:13,代码来源:ToolsKn5ObjectRenderer.cs

示例4: threshold

 public static void threshold(string image_path, string output_path, int brightness = 20, int contrast = 20, int posterize = 2)
 {
     using (MagickImage image = new MagickImage(image_path)) {
         image.BrightnessContrast(brightness, contrast);
         image.ColorSpace = ColorSpace.Gray;
         image.Posterize(posterize);
         image.Normalize();
         image.Write(output_path);
     }
 }
开发者ID:Neonarg,项目名称:TempestNotifier,代码行数:10,代码来源:Image.cs

示例5: Test_BrightnessContrast

 public void Test_BrightnessContrast()
 {
   using (MagickImage image = new MagickImage(Files.Builtin.Wizard))
   {
     ColorAssert.AreNotEqual(MagickColors.White, image, 340, 295);
     image.BrightnessContrast(new Percentage(50), new Percentage(50));
     image.Clamp();
     ColorAssert.AreEqual(MagickColors.White, image, 340, 295);
   }
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:10,代码来源:MagickImageTests.cs


注:本文中的ImageMagick.MagickImage.BrightnessContrast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。