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


C# MagickWand.Clone方法代码示例

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


在下文中一共展示了MagickWand.Clone方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SigmoidalTest

 public void SigmoidalTest()
 {
     double[] alpha = { 1, 2, 3, 4 };
     double[] beta = { 0 , 5000, 20000, 30000, 40000, 65000 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             foreach(var a in alpha)
             {
                 foreach(var b in beta)
                 {
                     using(var tmp = wand.Clone())
                     {
                         tmp.SigmoidalContrastImage(true, a, b);
                         
                         WriteImage("sigmoidal", file, new string[] { a.ToString(), b.ToString() }, tmp);
                     }
                 }
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:28,代码来源:ContrastTests.cs

示例2: ContrastTest

 public void ContrastTest()
 {
     double[] alpha = { 0, .5, 1, 1.1 };
     double[] beta = { 0 , 5000, 20000, 30000, 40000, 65000 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             using(var tmp = wand.Clone())
             {
                 tmp.ContrastImage(true);
                 
                 WriteImage("contrast", file, new string[] { "1" }, tmp);
                 
                 tmp.ContrastImage(true);
                 
                 WriteImage("contrast", file, new string[] { "2" }, tmp);
                 
                 tmp.ContrastImage(true);
                 
                 WriteImage("contrast", file, new string[] { "3" }, tmp);
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:30,代码来源:ContrastTests.cs

示例3: GetOptimalQuality

        public uint GetOptimalQuality(MagickWand wand)
        {
            var tmp = $"{Path.GetTempFileName()}.jpg";

            try
            {
                using(var tmpWand = wand.Clone())
                {
                    tmpWand.CompressionQuality = MAX_QUALITY;
                    wand.WriteImage(tmp, true);
                }

                var opts = new ImgminOptions
                {
                    ErrorThreshold = 0.08
                };

                var imgmin = new Imgmin(opts);
                var result = imgmin.Minify(tmp, tmp);

                if(!_quiet)
                {
                    Console.WriteLine(result.StandardOutput);
                }

                // the following has not been reliable, so figure out the
                // quality based on opening the tmp file.
                //return Convert.ToUInt32(result.StatsAfter.Quality);

                using(var qualWand = new MagickWand(tmp))
                {
                    return qualWand.ImageCompressionQuality;
                }
            }
            finally
            {
                File.Delete(tmp);
            }
        }
开发者ID:AerisG222,项目名称:SizePhotos,代码行数:39,代码来源:QualitySearcher.cs

示例4: ContrastStretchTest

 public void ContrastStretchTest()
 {
     double[] black = { 0, 100, 1000, 2000 };
     double[] white = { 0, 50000, 60000, 65000 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             foreach(var b in black)
             {
                 foreach(var w in white)
                 {
                     using(var tmp = wand.Clone())
                     {
                         tmp.ContrastStretchImage(b, w);
                         
                         WriteImage("contrast_stretch", file, new string[] { b.ToString(), w.ToString() }, tmp);
                     }
                 }
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:28,代码来源:ContrastTests.cs

示例5: BrightnessContrastTest

 public void BrightnessContrastTest()
 {
     double[] brightness = { 0, 10, 25 };
     double[] contrast = { 0, 10, 25 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             foreach(var b in brightness)
             {
                 foreach(var c in contrast)
                 {
                     using(var tmp = wand.Clone())
                     {
                         tmp.BrightnessContrastImage(b, c);
                         
                         WriteImage("brightness_contrast", file, new string[] { b.ToString(), c.ToString() }, tmp);
                     }
                 }
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:28,代码来源:ContrastTests.cs

示例6: ModulateTest

 public void ModulateTest()
 {
     double[] brightness = { 50, 100, 150 };
     double[] saturation = { 0, 100, 120, 150 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             foreach(var b in brightness)
             {
                 foreach(var s in saturation)
                 {
                     using(var tmp = wand.Clone())
                     {
                         tmp.ModulateImage(b, s, 300);  // 300 = no rotation
                         
                         WriteImage("modulate", file, new string[] { b.ToString(), s.ToString() }, tmp);
                     }
                 }
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:28,代码来源:ContrastTests.cs

示例7: LevelTest

 public void LevelTest()
 {
     double[] black = { 0, 100, 1000, 2000 };
     double[] white = { 0, 50000, 60000, 65000 };
     
     MagickWandEnvironment.Genesis();
     
     foreach(var file in _files)
     {
         using(var wand = new MagickWand(file))
         {
             foreach(var b in black)
             {
                 foreach(var w in white)
                 {
                     using(var tmp = wand.Clone())
                     {
                         tmp.LevelImage(b, 1, w);  // 1 = no gamma
                         
                         WriteImage("level", file, new string[] { b.ToString(), w.ToString() }, tmp);
                     }
                 }
             }
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:28,代码来源:ContrastTests.cs

示例8: TestNightOptimizations

 public void TestNightOptimizations()
 {
     MagickWandEnvironment.Genesis();
     
     using(var mw = new MagickWand("nighttest.jpg"))
     {
         using(var mw2 = mw.Clone())
         {
             mw2.AutoGammaImage();
             Write(mw2, "night_AutoGammaImage.jpg");
         }
         using(var mw2 = mw.Clone())
         {
             mw2.AutoLevelImage();
             Write(mw2, "night_AutoLevelImage.jpg");
         }
         using(var mw2 = mw.Clone())
         {
             mw2.LinearStretchImage(2, 98);
             Write(mw2, "night_LinearStretchImage.jpg");
         }
         using(var mw2 = mw.Clone())
         {
             mw2.NormalizeImage();
             Write(mw2, "night_NormalizeImage.jpg");
         }
     }
     
     MagickWandEnvironment.Terminus();
 }
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:30,代码来源:WrapperTests.cs

示例9: TestBasicWandMethods

        public void TestBasicWandMethods()
        {
            MagickWandEnvironment.Genesis();
            
            using(var pw = new PixelWand())
            using(var mw = new MagickWand("test.jpg"))
            {
                pw.Red = 200;
                
                using(var mw2 = mw.Clone())
                {
                    mw2.AdaptiveBlurImage(5, 2);
                    Write(mw2, "AdaptiveBlurImage.jpg");
                }
                
                using(var mw2 = mw.Clone())
                {
                    mw2.AdaptiveResizeImage(320, 212);
                    Write(mw2, "adaptiveResizeImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AdaptiveSharpenImage(20, 12);
                    Write(mw2, "AdaptiveSharpenImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AdaptiveThresholdImage(20, 12, 2);
                    Write(mw2, "AdaptiveThresholdImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AddNoiseImage(NoiseType.PoissonNoise);
                    Write(mw2, "AddNoiseImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AutoGammaImage();
                    Write(mw2, "AutoGammaImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AutoLevelImage();
                    Write(mw2, "AutoLevelImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.AutoOrientImage();
                    Write(mw2, "AutoOrientImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.BlurImage(10, 2);
                    Write(mw2, "BlurImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.BorderImage(pw, 10, 10);
                    Write(mw2, "BorderImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.BrightnessContrastImage(30, 20);
                    Write(mw2, "BrightnessContrastImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.CharcoalImage(30, 20);
                    Write(mw2, "CharcoalImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.ChopImage(30, 20, 0, 0);
                    Write(mw2, "ChopImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.ClampImage();
                    Write(mw2, "ClampImage.jpg");
                }
                /*
                using(var mw2 = mw.Clone())
                {
                    mw2.ClipImage();
                    Write(mw2, "ClipImage.jpg");
                }
                */
                using(var mw2 = mw.Clone())
                {
                    mw2.ContrastImage(true);
                    Write(mw2, "ContrastImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.ContrastStretchImage(2, 98);
                    Write(mw2, "ContrastStretchImage.jpg");
                }
                using(var mw2 = mw.Clone())
                {
                    mw2.CropImage(30, 20, 0, 0);
//.........这里部分代码省略.........
开发者ID:AerisG222,项目名称:NMagickWand,代码行数:101,代码来源:WrapperTests.cs

示例10: ProcessPhotoAsync

 public async Task<ProcessingResult> ProcessPhotoAsync(string filename)
 {
     var result = new ProcessingResult();
     var jpgName = Path.ChangeExtension(filename, ".jpg");
     var origPath = _pathHelper.GetSourceFilePath(filename);
     var srcPath = _pathHelper.GetScaledLocalPath(SourceTarget.ScaledPathSegment, filename);
     
     result.ExifData = await _exifReader.ReadExifDataAsync(origPath);
     
     // always keep the original in the source dir
     File.Move(origPath, srcPath);
     result.Source = new ProcessedPhoto { 
         Target = SourceTarget, 
         LocalFilePath = srcPath, 
         WebFilePath = _pathHelper.GetScaledWebFilePath(SourceTarget.ScaledPathSegment, filename)
     };
     
     using(var wand = new MagickWand())
     {
         if(_rawConverter.IsRawFile(srcPath))
         {
             result.RawConversionResult = await _rawConverter.ConvertAsync(srcPath);
             
             wand.ReadImage(result.RawConversionResult.OutputFile);
             File.Delete(result.RawConversionResult.OutputFile);
         } 
         else 
         {
             wand.ReadImage(srcPath);
         }
         
         result.Source.Height = wand.ImageHeight;
         result.Source.Width = wand.ImageWidth;
         
         wand.AutoOrientImage();
         wand.StripImage();
         
         using(var optWand = wand.Clone())
         {
             result.OptimizationResult = _optimizer.Optimize(optWand);
             
             // get the best compression quality for the optimized image
             // (best => smallest size for negligible quality loss)
             result.CompressionQuality = (short)_qualitySearcher.GetOptimalQuality(optWand);
             
             result.Xs = ProcessTarget(wand, optWand, result.CompressionQuality, XsTarget, jpgName);
             result.Sm = ProcessTarget(wand, optWand, result.CompressionQuality, SmTarget, jpgName);
             result.Md = ProcessTarget(wand, optWand, result.CompressionQuality, MdTarget, jpgName);
             result.Lg = ProcessTarget(wand, optWand, result.CompressionQuality, LgTarget, jpgName);
             result.Print = ProcessTarget(wand, optWand, result.CompressionQuality, PrintTarget, jpgName);
         }
     }
     
     return result;
 }
开发者ID:AerisG222,项目名称:SizePhotos,代码行数:55,代码来源:PhotoProcessor.cs


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