Lossless

WebPOptions.Lossless property

获取或设置一个值,该值指示是否WebPOptions是无损的。

public bool Lossless { get; set; }

适当的价值

真的如果无损;否则,错误的 .

例子

此示例说明如何从另一个具有不同压缩质量的光栅图像创建 WebP 图像。

[C#]

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

// 加载一个 GIF 动画
using (Aspose.Imaging.Image image = new Aspose.Imaging.Image.Load(dir + "test.gif"))
{
    // 对于无损压缩,增加质量设置会提高压缩质量并减小文件大小
    image.Save(
        dir + "output_lossless_20.webp",
        new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = true, Quality = 20 }); // 文件大小:42 KB

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

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


    // 对于有损压缩,增加 Quality 值会提高图像质量并增加文件大小
    image.Save(
        dir + "output_lossy_20.webp",
        new  Aspose.Imaging.ImageOptions.WebPOptions() { Lossless = false, Quality = 20 }); // 文件大小:24 KB

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

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

也可以看看