Skip to content

Function: imageSize() ​

ts
function imageSize(
   pixels, 
   box, 
   options?
): SizeField;

Tile size from a picture's brightness: dark areas get dark (default 0.25), light ones light (default 1), so detail gathers where the picture has it. pixels is RGBA data, as from loadImagePixels; the picture covers box (normally the layout's bounds), cropped like object-fit: cover. Use invert for small tiles in the light.

Parameters ​

ParameterType
pixels{ data: ArrayLike<number>; height: number; width: number; }
pixels.dataArrayLike<number>
pixels.heightnumber
pixels.widthnumber
boxRect
options{ dark?: number; invert?: boolean; light?: number; }
options.dark?number
options.invert?boolean
options.light?number

Returns ​

SizeField

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