Skip to Content
defold-typescript libraries
HalfstarDev

HalfstarDev/defold-webp/webp

A WebP image library.

  • GitHub: HalfstarDev/defold-webp — pinned to 1.0.0 (released while Defold 1.12.2 was current)
    1. Pick a release from HalfstarDev/defold-webp releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as webp from "webp"
  • Asset Portal: defold-webp

Functions

webp.decode(image: string, options?: table)

Decodes WebP image to buffer.

Parameters

  • image: string — File data or file path of a WebP image.
  • options?: table — Table of WebPDecoderOptions.

webp.encode(image: string, width: number, height: number, options?: table)

Encodes buffer to WebP image.

Parameters

  • image: string — File data or file path of a WebP image.
  • width: number — Width of buffer image.
  • height: number — Height of buffer image.
  • options?: table — Table of WebPConfig options.

webp.get_info(image: string)

Returns information about WebP image.

Parameters

  • image: string — File data or file path of a WebP image.

On this page