Aspose.Imaging.Examples.CSharp.ModifyingAndConvertingImages.ConvertWMFToWebp.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:ConvertWMFToWebp
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an existing WMF image
            using (Image image = Image.Load(dataDir + "input.wmf"))
            {
                // Calculate new Webp image height
                double k = (image.Width * 1.00) / image.Height;

                // Create an instance of EmfRasterizationOptions class and set different properties
                EmfRasterizationOptions emfRasterization = new EmfRasterizationOptions
                {
                    BackgroundColor = Color.WhiteSmoke,
                    PageWidth = 400,
                    PageHeight = (int)Math.Round(400 / k),
                    BorderX = 5,
                    BorderY = 10
                };

                // Create an instance of WebPOptions class and provide rasterization option
                ImageOptionsBase imageOptions = new WebPOptions();
                imageOptions.VectorRasterizationOptions = emfRasterization;

                // Call the save method, provide output path and WebPOptions to convert the WMF file to Webp and save the output
                image.Save(dataDir + "ConvertWMFToWebp_out.webp", imageOptions);
            }
            // ExEnd:ConvertWMFToWebp
        }
    }
ConvertWMFToWebp