本文整理汇总了C#中MagickWand.SaveImage方法的典型用法代码示例。如果您正苦于以下问题:C# MagickWand.SaveImage方法的具体用法?C# MagickWand.SaveImage怎么用?C# MagickWand.SaveImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagickWand
的用法示例。
在下文中一共展示了MagickWand.SaveImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CoverArtWandRotateTests
public void CoverArtWandRotateTests()
{
using (var wand = new MagickWand(this.TestImageFolder1))
{
wand.CurrentImage.RotateImage(new PixelWand("transparent", 1), 30);
//wand.CurrentImage.TrimImage(10);
wand.SaveImage(Path.Combine(SaveDirectory, "logo_extent.png"));
}
}
示例2: MediaBrowserClipMaskTest
public void MediaBrowserClipMaskTest()
{
var dest = new MagickWand(100, 100);
var mask = new MagickWand();
var src = new MagickWand(100, 100);
dest.OpenImage(this.TestImageFolder1);
mask.OpenImage(this.TestImageFolder2);
mask.CurrentImage.NegateImage(false);
mask.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdropMask.png"));
dest.CurrentImage.SetImageClipMask(mask);
src.OpenImage(this.TestImageBackdrop);
dest.CurrentImage.CompositeImage(src, CompositeOperator.OverCompositeOp, 0, 0);
dest.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.png"));
}
示例3: TestWebp
private void TestWebp()
{
try
{
var tmpPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".webp");
Directory.CreateDirectory(Path.GetDirectoryName(tmpPath));
using (var wand = new MagickWand(1, 1, new PixelWand("none", 1)))
{
wand.SaveImage(tmpPath);
}
}
catch (Exception ex)
{
_logger.ErrorException("Error loading webp: ", ex);
_webpAvailable = false;
}
}
示例4: ExtendcanvasaroundimageTest
public void ExtendcanvasaroundimageTest()
{
var path = TestImageThumb;
Assert.IsTrue(File.Exists(path));
using (var wand = new MagickWand(path))
{
wand.OpenImage(path);
var w = wand.CurrentImage.Width;
var h = wand.CurrentImage.Height;
using (PixelWand newPixelWand = new PixelWand("blue"))
{
wand.CurrentImage.BackgroundColor = newPixelWand;
}
wand.CurrentImage.ExtentImage(1024, 768, -(1024 - w) / 2, -(768 - h) / 2);
wand.SaveImage(Path.Combine(SaveDirectory, "logo_extent.jpg"));
}
}
示例5: DrawingWandAnnotationTest
public void DrawingWandAnnotationTest()
{
//using (var wand = new MagickWand(TestImageBackdrop))
using (var wand = new MagickWand(400, 100, "#ffffff"))
{
//wand.NewImage(400, 200, new PixelWand("white"));
//wand.OpenImage(TestImageBackdrop);
using (var draw = new DrawingWand())
{
using (PixelWand pixel = new PixelWand("black"))
{
draw.FillColor = pixel;
draw.Font = "Arial";
draw.FontSize = 20;
draw.FontStyle = FontStyleType.NormalStyle;
draw.TextAlignment = TextAlignType.LeftAlign;
draw.FontWeight = FontWeightType.BoldStyle;
draw.TextAntialias = true;
draw.DrawAnnotation(0, 20, "Media Browser");
draw.BorderColor = new PixelWand("red");
//draw.Font = "Times-New-Roman";
//pixel.Color = "Red";
//pixel.Opacity = 0.8;
//draw.FillColor = pixel;
//draw.DrawAnnotation(60, 120, "Tavares");
Debug.WriteLine(draw);
wand.CurrentImage.DrawImage(draw);
}
}
//Debug.WriteLine(wand.GetNumberImages());
//wand.Image.TrimImage(10);
wand.SaveImage(Path.Combine(SaveDirectory, "logo_extent.jpg"));
}
}
示例6: EncodeImage
public void EncodeImage(string inputPath, string outputPath, int width, int height, int quality, ImageProcessingOptions options)
{
if (string.IsNullOrWhiteSpace(options.BackgroundColor) || !HasTransparency(inputPath))
{
using (var originalImage = new MagickWand(inputPath))
{
originalImage.CurrentImage.ResizeImage(width, height);
DrawIndicator(originalImage, width, height, options);
originalImage.CurrentImage.CompressionQuality = quality;
originalImage.SaveImage(outputPath);
}
}
else
{
using (var wand = new MagickWand(width, height, options.BackgroundColor))
{
using (var originalImage = new MagickWand(inputPath))
{
originalImage.CurrentImage.ResizeImage(width, height);
wand.CurrentImage.CompositeImage(originalImage, CompositeOperator.OverCompositeOp, 0, 0);
DrawIndicator(wand, width, height, options);
wand.CurrentImage.CompressionQuality = quality;
wand.SaveImage(outputPath);
}
}
}
SaveDelay();
}
示例7: ResizeImageTestDir
public void ResizeImageTestDir()
{
var path = @"D:\Video\TV\Carnivàle\Season 2\Carnivàle - 2x09 - Lincoln Highway DVD.jpg";
Assert.IsTrue(File.Exists(path));
using (var wand = new MagickWand(path))
{
wand.CurrentImage.ResizeImage(400, 150);
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.jpg"));
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.png"));
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.webp"));
}
}
示例8: ResizeImageTest
public void ResizeImageTest()
{
var path = TestImageLogo;
Assert.IsTrue(File.Exists(path));
using (var wand = new MagickWand(path))
{
wand.CurrentImage.ResizeImage(400, 150);
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.jpg"));
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.png"));
wand.SaveImage(Path.Combine(SaveDirectory, "TestResize.webp"));
}
}
示例9: DrawingWandCircleTest
public void DrawingWandCircleTest()
{
using (var wand = new MagickWand(TestImageBackdrop))
{
//wand.NewImage(400, 200, new PixelWand("white"));
//wand.OpenImage(TestImageBackdrop);
using (var draw = new DrawingWand())
{
using (PixelWand pixel = new PixelWand())
{
pixel.Color = "red";
draw.StrokeColor = pixel;
pixel.Color = "black";
pixel.Opacity = 0.3;
draw.FillColor = pixel;
draw.DrawCircle(400, 400, 300, 300);
pixel.Color = "transparent";
draw.StrokeColor = pixel;
pixel.Color = "white";
draw.FillColor = pixel;
draw.Font = "Verdana";
draw.FontSize = 120;
draw.FontStyle = FontStyleType.NormalStyle;
draw.TextAlignment = TextAlignType.LeftAlign;
draw.FontWeight = FontWeightType.BoldStyle;
draw.TextAntialias = true;
draw.DrawAnnotation(10, 100, "Media Browser");
draw.FillColor = pixel;
wand.CurrentImage.DrawImage(draw);
}
}
//Debug.WriteLine(wand.GetNumberImages());
//wand.Image.TrimImage(10);
wand.SaveImage(Path.Combine(SaveDirectory, "logo_extent.jpg"));
}
}
示例10: SaveImageTest
public void SaveImageTest()
{
var path = TestImageLogo;
Assert.IsTrue(File.Exists(path));
using (var wand = new MagickWand(path))
{
wand.SaveImage(Path.Combine(SaveDirectory, "test.jpg"));
wand.SaveImage(Path.Combine(SaveDirectory, "test.png"));
wand.SaveImage(Path.Combine(SaveDirectory, "test.webp"));
}
}
示例11: NewImageTest2
public void NewImageTest2()
{
using (var wand = new MagickWand(100, 100, "#ffffff"))
{
//wand.NewImage(100, 100, "#ffffff");
wand.SaveImage(Path.Combine(SaveDirectory, "TestSetBackgroundColor.png"));
}
}
示例12: MediaBrowserWandRoundCornersTest
public void MediaBrowserWandRoundCornersTest()
{
var cofactor = 15;
using (var wand = new MagickWand(TestImageBackdrop).RoundCorners(cofactor))
wand.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.png"));
}
示例13: MediaBrowserWandOverlayTests
public void MediaBrowserWandOverlayTests()
{
using (var wand = new MagickWand(TestImageBackdrop))
{
using (MagickWand wandComposit = new MagickWand(TestImageLogo))
{
//draw.FillOpacity = 0.5;
wand.CurrentImage.OverlayImage(CompositeOperator.AtopCompositeOp, 560, 660, wandComposit.CurrentImage.Width, wandComposit.CurrentImage.Height, wandComposit);
}
wand.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.jpg"));
}
}
示例14: MediaBrowserWandCropWhitespaceTests
public void MediaBrowserWandCropWhitespaceTests()
{
using (var wand = new MagickWand(TestImageLogo))
{
wand.CurrentImage.TrimImage(10);
wand.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.png"));
}
}
示例15: SaveImageWithQualityTest
public void SaveImageWithQualityTest()
{
var path = TestImageFolder3;
Assert.IsTrue(File.Exists(path));
using (var wand = new MagickWand(path))
{
wand.CurrentImage.CompressionQuality = 90;
wand.SaveImage(Path.Combine(SaveDirectory, "test.jpg"));
wand.CurrentImage.CompressionQuality = 90;
wand.SaveImage(Path.Combine(SaveDirectory, "test.png"));
wand.CurrentImage.CompressionQuality = 90;
wand.SaveImage(Path.Combine(SaveDirectory, "test.webp"));
}
}