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


C# MagickWand.SaveImage方法代码示例

本文整理汇总了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"));
     }
 }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:9,代码来源:CoverArtWandTests.cs

示例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"));
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:15,代码来源:MediaBrowserWandTests.cs

示例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;
            }
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:18,代码来源:ImageMagickEncoder.cs

示例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"));

            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:21,代码来源:ImageWandTests.cs

示例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"));

            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:36,代码来源:DrawingWandTests.cs

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

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:15,代码来源:ImageWandTests.cs

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:15,代码来源:ImageWandTests.cs

示例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"));

            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:41,代码来源:DrawingWandTests.cs

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:14,代码来源:MagickWandTests.cs

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:9,代码来源:MagickWandTests.cs

示例12: MediaBrowserWandRoundCornersTest

 public void MediaBrowserWandRoundCornersTest()
 {
     var cofactor = 15;
     using (var wand = new MagickWand(TestImageBackdrop).RoundCorners(cofactor))
         wand.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.png"));
 }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:6,代码来源:MediaBrowserWandTests.cs

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:13,代码来源:MediaBrowserWandTests.cs

示例14: MediaBrowserWandCropWhitespaceTests

 public void MediaBrowserWandCropWhitespaceTests()
 {
     using (var wand = new MagickWand(TestImageLogo))
     {
         wand.CurrentImage.TrimImage(10);
         wand.SaveImage(Path.Combine(SaveDirectory, "TestImageBackdrop.png"));
     }
 }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:8,代码来源:MediaBrowserWandTests.cs

示例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"));
            }
        }
开发者ID:NazioByte,项目名称:ImageMagickSharp,代码行数:18,代码来源:MagickWandTests.cs


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