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


C# MagickImage.Negate方法代码示例

本文整理汇总了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;
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:50,代码来源:Effect.cs

示例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]");
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:21,代码来源:MagickImage.cs

示例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();
            }
        }
开发者ID:dynamicdeploy,项目名称:ReceiptOCR,代码行数:68,代码来源:Form1.cs

示例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);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:22,代码来源:MagickImageTests.cs


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