Class WebPOptions

Class WebPOptions

Именује се: Aspose.Imaging.ImageOptions Асамблеја: Aspose.Imaging.dll (25.4.0)

Креирајте модерне WebP растер веб слике користећи нашу АПИ, са јаком подршком забез губитка и губитне компресије, као и алфа канала и анимације пролазе.Побољшајте свој веб садржај динамичким визуелима док оптимизујете величине датотекаЗа побољшање брзине пуњења и корисничког искуства.

[JsonObject(MemberSerialization.OptIn)]
public class WebPOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable

Inheritance

object DisposableObject ImageOptionsBase WebPOptions

Implements

IDisposable , IHasXmpData , IHasMetadata , ICloneable

Наслеђени чланови

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Овај пример показује како да креирате ВебП слику из другог растер слике са различитим квалитетом компресије.

string dir = "c:\\temp\\";

                                                                                                                      // Load a GIF animation
                                                                                                                      using (Aspose.Imaging.Image image = new Aspose.Imaging.Image.Load(dir + "test.gif"))
                                                                                                                      {
                                                                                                                          // for lossless compression, increasing the quality setting increases the compression quality and decreases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 20 }); // file size: 42 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 50 }); // file size: 41 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 80 }); // file size: 40 KB


                                                                                                                          // for lossy compression, increasing the Quality value increases the image quality and increases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 20 }); // file size: 24 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 50 }); // file size: 36 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 80 }); // file size: 51 KB
                                                                                                                      }

Следећи пример показује како конвертовати вишестраничну векторску слику у WEBP формат уопште без референције на одређени тип слике.

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
                                                                                                                                                            string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
                                                                                                                                                            string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.webp");

                                                                                                                                                            Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.WebPOptions();

                                                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
                                                                                                                                                            {
                                                                                                                                                                exportOptions.MultiPageOptions = null;

                                                                                                                                                                // Export only first two pages. These pages will be presented as animated frames in the output WEBP.
                                                                                                                                                                Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
                                                                                                                                                                if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
                                                                                                                                                                {
                                                                                                                                                                    exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
                                                                                                                                                                }

                                                                                                                                                                if (image is Aspose.Imaging.VectorImage)
                                                                                                                                                                {
                                                                                                                                                                    exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
                                                                                                                                                                    exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
                                                                                                                                                                    exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
                                                                                                                                                                }

                                                                                                                                                                image.Save(outputFilePath, exportOptions);
                                                                                                                                                            }

Constructors

Вебпопција()

[JsonConstructor]
public WebPOptions()

Properties

AnimBackgroundColor

Добија или поставља боју анимационог позадине.

[JsonProperty]
public uint AnimBackgroundColor { get; set; }

Вредност имовине

uint

AnimLoopCount

Добијете или постављате број анимационог круга.

[JsonProperty]
public ushort AnimLoopCount { get; set; }

Вредност имовине

ushort

Lossless

Добија или поставља вредност која указује на то да ли је овај Aspose.Imaging.ImageOptions.WebPOptions без губитка.

[JsonProperty]
public bool Lossless { get; set; }

Вредност имовине

bool

Examples

Овај пример показује како да креирате ВебП слику из другог растер слике са различитим квалитетом компресије.

string dir = "c:\\temp\\";

                                                                                                                      // Load a GIF animation
                                                                                                                      using (Aspose.Imaging.Image image = new Aspose.Imaging.Image.Load(dir + "test.gif"))
                                                                                                                      {
                                                                                                                          // for lossless compression, increasing the quality setting increases the compression quality and decreases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 20 }); // file size: 42 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 50 }); // file size: 41 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 80 }); // file size: 40 KB


                                                                                                                          // for lossy compression, increasing the Quality value increases the image quality and increases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 20 }); // file size: 24 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 50 }); // file size: 36 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 80 }); // file size: 51 KB
                                                                                                                      }

Quality

Добија или поставља квалитет.

[JsonProperty]
public float Quality { get; set; }

Вредност имовине

float

Examples

Овај пример показује како да креирате ВебП слику из другог растер слике са различитим квалитетом компресије.

string dir = "c:\\temp\\";

                                                                                                                      // Load a GIF animation
                                                                                                                      using (Aspose.Imaging.Image image = new Aspose.Imaging.Image.Load(dir + "test.gif"))
                                                                                                                      {
                                                                                                                          // for lossless compression, increasing the quality setting increases the compression quality and decreases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 20 }); // file size: 42 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 50 }); // file size: 41 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossless_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 80 }); // file size: 40 KB


                                                                                                                          // for lossy compression, increasing the Quality value increases the image quality and increases the file size
                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_20.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 20 }); // file size: 24 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_50.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 50 }); // file size: 36 KB

                                                                                                                          image.Save(
                                                                                                                              dir + "output_lossy_80.webp",
                                                                                                                              new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 80 }); // file size: 51 KB
                                                                                                                      }
 Српски