Skip to content

computeVariantDimensions

function computeVariantDimensions(asset, preset):
| {
height: number;
width: number;
}
| null;

Defined in: packages/asset-client/src/index.ts:353

Compute the dimensions a variant would have given the source asset’s width/height and the variant’s bounding box. For thumbnails (square smart-crop) the result is always 256×256; for the other presets, scales the max side to the box dimension and the other side proportionally.

Parameter Type
asset Pick<AssetDTO, "w" | "h">
preset VariantPreset

| { height: number; width: number; } | null