Class WebPOptions
Названий на: Aspose.Imaging.ImageOptions Асамблея: Aspose.Imaging.dll (25.4.0)
Створення сучасних веб-зображень WebP raster за допомогою нашого API, що забезпечує міцну підтримку длябез втрат і збитків компресія, а також альфа-канали і анімаційні прогулянки.Підвищити свій веб-контент за допомогою динамічних зображень при оптимізації розмірів файлівДля поліпшення швидкості завантаження та досвіду користувача.
[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
Цей приклад показує, як створити зображення WebP з іншого растер з різною якістю компресії.
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; }
вартість нерухомості
AnimLoopCount
Отримайте або встановіть анімаційний цикл.
[JsonProperty]
public ushort AnimLoopCount { get; set; }
вартість нерухомості
Lossless
Ви отримаєте або встановите значення, що вказує на те, чи це Aspose.Imaging.ImageOptions.WebPOptions без втрат.
[JsonProperty]
public bool Lossless { get; set; }
вартість нерухомості
Examples
Цей приклад показує, як створити зображення WebP з іншого растер з різною якістю компресії.
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; }
вартість нерухомості
Examples
Цей приклад показує, як створити зображення WebP з іншого растер з різною якістю компресії.
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
}