import type { WebpEncodeOptions, WebpImageData } from './types'; /** * Shell out to the system `cwebp` binary (libwebp) for real WebP * encoding. Returns the encoded bytes, or `null` if the binary * isn't available or fails to run. * * Why bother shelling out? The bundled VP8 lossy encoder in this * package is "minimal-but-functional" — single-segment, 16×16 * intra-DC prediction, no mode search, no rate-control loop — so * the output is competitively *correct* but not competitively * *small*. For real-world traffic (catalog photos, OG images, the * whole point of WebP) you want libwebp's R/D loop. Shelling out * is the cheap path: any modern dev machine and most CI runners * already have `cwebp` (Homebrew `webp`, apt `webp`, etc.). * * The transport is a 4-byte BE width + 4-byte BE height + raw RGBA * payload, fed to `cwebp` over stdin via the `-` (stdin) form. We * read the encoded bytes back from stdout. No temp files. * * Why not write a PNG and pipe that? `cwebp` accepts PNG/JPEG/TIFF/ * WebP/PAM/PPM/PGM; the simplest format we can synthesize with no * dependencies is PAM (P7 / portable arbitrary map), which is just * a header + raw RGBA. That's what we use here — it lets `cwebp` * decode our exact pixels without us having to ship a PNG encoder * just to talk to it. */ export declare function encodeViaCwebp(imageData: WebpImageData, options: WebpEncodeOptions): Promise; export declare function hasCwebp(binPath?: string): Promise;