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)- Pick a release from HalfstarDev/defold-webp releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as webp from "webp"
- Pick a release from HalfstarDev/defold-webp releases and add its Source code (zip) URL (or a packaged
- 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.