Optionalgl: WebGLRenderingContext | nullRun all filters as GPU passes and return the result.
Accepts ImageData, HTMLImageElement, HTMLCanvasElement, or ImageBitmap.
Load an image from a URL and apply filters.
Returns a Promise that resolves to the filtered ImageData.
Compile the filter chain for efficient reuse.
Returns a CompiledFilter that caches shader programs.
const filter = glFilters()
.addFilter(brightness({ amount: 0.1 }))
.compile();
// Reuse for multiple images
const r1 = filter.apply(image1);
const r2 = filter.apply(image2);
// Or apply to a video element
const canvas = filter.apply(videoElement);
document.body.appendChild(canvas);
filter.dispose();
Generate a self-contained debug HTML page that visualizes each filter step. Logs a data URI to the console that can be opened in a browser.
Returns a copy of the current filter list.
Chainable filter chain. Collects filters, then applies them as sequential GPU shader passes.
Example