WebP
WebP test files generated in your browser
Generate WebP fixtures locally for modern image delivery, upload validation, conversion, dimensions, and compatibility tests.
Verified . Generated Blob RIFF/WEBP identifiers and decoded output are checked locally.
Identify WebP files
- Magic signature
52 49 46 46 · 57 45 42 50 (RIFF…WEBP)- Registered MIME
image/webp
WebP is a RIFF container. Validate RIFF and WEBP identifiers and then decode the contained VP8, VP8L, or VP8X payload.
Choosing WebP
WebP is supported by current major browsers and many image libraries; older downstream tools may still require JPG or PNG.
Use WebP for web delivery and conversion workflows.
Check both upload acceptance and output Content-Type after conversion.
Common test cases
- Modern format negotiation
- Compression comparison
- Fallback and conversion workflows
Invalid and boundary cases
- RIFF file that is not WebP
- Animated or extended WebP
- Incorrect Content-Type after conversion
WebP fixture matrix
This format is generated locally in the browser and does not receive a permanent SEO URL.
Open the local generatorGenerate and verify locally
These examples use the browser generator because this format has no permanent downloadable SEO URL. Generate the bytes locally, then validate the physical size and format signature before using the fixture in an upload, rendering, waveform, or conversion test.
Generate a deterministic 64 KiB WebP fixture through the production UI, then assert both its physical byte length and signature. The test fails if the browser cannot encode the format, the download is missing, padding is inaccurate, or the bytes do not match WebP.
import { test, expect } from "@playwright/test";
import { readFile } from "node:fs/promises";
test("generate an exact WebP fixture", async ({ page }) => {
await page.goto("https://testfiles.dev/#generator");
await page.locator("#gType").selectOption("webp");
await page.locator("#gW").fill("64");
await page.locator("#gH").fill("64");
await page.locator("#gFill").selectOption("kb");
await page.locator("#gSize").fill("64");
await page.locator("#gName").fill("exact-64k.webp");
const download = page.waitForEvent("download");
await page.locator("#gGo").click();
const result = await download;
const path = await result.path();
if (!path) throw new Error("Browser did not expose the downloaded file");
const bytes = await readFile(path);
expect(bytes).toHaveLength(64 * 1024);
expect(bytes.subarray(0, 4).toString("ascii")).toBe("RIFF");
expect(bytes.subarray(8, 12).toString("ascii")).toBe("WEBP");
});Validate a generated WebP before passing it to an upload or conversion pipeline. A matching extension or declared MIME is not accepted as proof; the command exits with an error when the signature is missing or disguised.
import { readFile } from "node:fs/promises";
const path = process.argv[2];
if (!path) throw new Error("Usage: node verify-webp.mjs <fixture>");
const bytes = await readFile(path);
if (bytes.subarray(0, 4).toString("ascii") !== "RIFF" ||
bytes.subarray(8, 12).toString("ascii") !== "WEBP") {
throw new Error("Missing RIFF/WEBP identifiers");
}
console.log({ path, format: "WebP", byteSize: bytes.length });