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


C# MagickWand.StripImage方法代码示例

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


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

示例1: ProcessPhotoAsync

        public async Task<ProcessingResult> ProcessPhotoAsync(string filename)
        {
            using(var wand = new MagickWand())
            {
                var srcFile = _pathHelper.GetSourceFilePath(filename);

                if(_rawConverter.IsRawFile(srcFile))
                {
                    var conversionResult = await _rawConverter.ConvertAsync(srcFile);
                    
                    wand.ReadImage(conversionResult.OutputFile);
                    File.Delete(conversionResult.OutputFile);
                } 
                else 
                {
                    wand.ReadImage(srcFile);
                }
                
                wand.AutoOrientImage();
                wand.AutoLevelImage();
                wand.StripImage();
                
                var path = Path.Combine(Path.GetDirectoryName(srcFile), "review", $"{Path.GetFileNameWithoutExtension(filename)}.jpg");

                wand.WriteImage(path, true);
            }
            
            return null;
        }
开发者ID:AerisG222,项目名称:SizePhotos,代码行数:29,代码来源:FastReviewPhotoProcessor.cs

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