Skip to content

Function: loadImagePixels() ​

ts
function loadImagePixels(src, maxSize?): Promise<Pixels>;

Browser helper: load an image and read its pixels, scaled down so the longer side is at most maxSize (plenty for averaging, and fast). The image must be same-origin, a data URL, or served with CORS headers; otherwise the browser refuses to read its pixels.

Parameters ​

ParameterTypeDefault value
srcstringundefined
maxSizenumber256

Returns ​

Promise<Pixels>

Hat tiling and isohedral tilings after Craig S. Kaplan's hatviz and Tactile (BSD 3-Clause).