/** The four webp command-line tools this library wraps. */ type WebpTool = 'cwebp' | 'dwebp' | 'gif2webp' | 'webpmux'; /** Env var pointing to a directory of custom webp binaries. */ declare const BIN_DIR_ENV = "WEBP_CONVERTER_BIN_DIR"; /** * Point the library at your own directory of webp binaries (e.g. a newer * libwebp release, or a platform not bundled with the package). The directory * must contain the tools directly: `cwebp`, `dwebp`, `gif2webp`, `webpmux` * (with `.exe` extensions on Windows). * * Pass `undefined` to clear the override and go back to the bundled binaries. * Takes precedence over the `WEBP_CONVERTER_BIN_DIR` environment variable. */ declare function setBinaryDir(dir: string | undefined): void; /** A single frame passed to {@link webpmux_animate}. */ interface AnimationFrame { /** Path to the source `.webp` frame. */ path: string; /** webpmux frame options, e.g. `"+100"` or `"+100+50+50+1+b"`. */ offset: string; } /** * Grant `0o755` to the bundled webp binaries. Required once on Linux/macOS * after install, where npm may not preserve the executable bit. No-op-safe to * call on Windows. */ declare function grant_permission(): void; /** * Convert any image (jpeg, png, …) to webp. * @param input_image Path to the source image. * @param output_image Path to write the `.webp` output. * @param option cwebp options, e.g. `"-q 80"`. * @param logging libwebp logging flag (`"-quiet"` by default, `"-v"` for verbose). */ declare function cwebp(input_image: string, output_image: string, option: string, logging?: string): Promise; /** * Convert a webp image back to another format (jpeg, png, …). * @param input_image Path to the source `.webp` image. * @param output_image Path to write the decoded output. * @param option dwebp options, e.g. `"-o"`. * @param logging libwebp logging flag. */ declare function dwebp(input_image: string, output_image: string, option: string, logging?: string): Promise; /** * Convert a gif to an (animated) webp. * @param input_image Path to the source `.gif`. * @param output_image Path to write the `.webp` output. * @param option gif2webp options, e.g. `"-q 80"`. * @param logging libwebp logging flag. */ declare function gwebp(input_image: string, output_image: string, option: string, logging?: string): Promise; /** * Add an ICC profile, XMP metadata or EXIF metadata to a webp image. * @param option `"icc"`, `"xmp"` or `"exif"`. * @param logging Ignored (webpmux has no logging flag); kept for 2.x compatibility. */ declare function webpmux_add(input_image: string, output_image: string, icc_profile: string, option: string, logging?: string): Promise; /** * Extract an ICC profile, XMP metadata or EXIF metadata from a webp image. * @param option `"icc"`, `"xmp"` or `"exif"`. * @param logging Ignored (webpmux has no logging flag); kept for 2.x compatibility. */ declare function webpmux_extract(input_image: string, icc_profile: string, option: string, logging?: string): Promise; /** * Strip an ICC profile, XMP metadata or EXIF metadata from a webp image. * @param option `"icc"`, `"xmp"` or `"exif"`. * @param logging Ignored (webpmux has no logging flag); kept for 2.x compatibility. */ declare function webpmux_strip(input_image: string, output_image: string, option: string, logging?: string): Promise; /** * Create an animated webp from an array of webp frames. * @param input_images Frames as `{ path, offset }` objects. * @param loop Number of loops (`"0"` = forever). * @param bgcolor Canvas background, e.g. `"255,255,255,255"`. * @param logging Ignored (webpmux has no logging flag); kept for 2.x compatibility. */ declare function webpmux_animate(input_images: AnimationFrame[], output_image: string, loop: string | number, bgcolor: string, logging?: string): Promise; /** * Extract a single frame from an animated webp. * @param logging Ignored (webpmux has no logging flag); kept for 2.x compatibility. */ declare function webpmux_getframe(input_image: string, output_image: string, frame_number: string | number, logging?: string): Promise; /** Convert a base64-encoded image string to a base64-encoded webp string. */ declare function str2webpstr(base64str: string, image_type: string, option: string, extra_path?: string): Promise; /** Convert an image buffer to a webp buffer. */ declare function buffer2webpbuffer(buffer: Buffer | Uint8Array, image_type: string, option: string, extra_path?: string): Promise; declare const webp: { grant_permission: typeof grant_permission; setBinaryDir: typeof setBinaryDir; cwebp: typeof cwebp; dwebp: typeof dwebp; gwebp: typeof gwebp; webpmux_add: typeof webpmux_add; webpmux_extract: typeof webpmux_extract; webpmux_strip: typeof webpmux_strip; webpmux_animate: typeof webpmux_animate; webpmux_getframe: typeof webpmux_getframe; str2webpstr: typeof str2webpstr; buffer2webpbuffer: typeof buffer2webpbuffer; }; export { type AnimationFrame, BIN_DIR_ENV, type WebpTool, buffer2webpbuffer, cwebp, webp as default, dwebp, grant_permission, gwebp, setBinaryDir, str2webpstr, webpmux_add, webpmux_animate, webpmux_extract, webpmux_getframe, webpmux_strip };