本文整理汇总了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;
}
示例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;
}