Skip to content
FutureBlitz

    Install

    Import std.image.webp

    std.image.webp

    WebP, over libwebp: WebP.Decode reads a still WebP, lossy or lossless, with or without alpha, and Encode writes a lossy one at a quality, and EncodeLossless a lossless one at an effort, which keeps every pixel as it is, the colors of transparent ones too. An animated WebP isn't read.

    std/image/webp.fb

    Types

    WebP struct

    Public Struct WebP

    What reads and writes WebP images, in its Static Methods.

    std/image/webp.fb, line 11

    • @PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): Image Throws IOError static method #

      The image in data, a still WebP. Throws an IOError of INVALID_DATA when the data isn't a WebP or is broken, UNEXPECTED_END when it ends too soon, and OTHER when it's animated or the image has more pixels than limit. Panics when the limit is negative.

    • @PanicsAtCaller Public Static Method Encode(image: Image, quality: Int = 75): UInt8[] static method #

      The lossy WebP of the image at quality, from 0 to 100, its alpha kept losslessly. Panics when the quality is another, or the image has no pixels or a side longer than 16383.

    • @PanicsAtCaller Public Static Method EncodeLossless(image: Image, effort: Int = 6): UInt8[] static method #

      The lossless WebP of the image, at effort, from 0, the fastest, to 9, the smallest. Panics when the effort is another, or the image has no pixels or a side longer than 16383.

    Report an issue with this page or with FutureBlitz on GitHub.