Usage

Measure a remote image.

tsx
// Measure a remote image.
import { image } from 'kuito';

function fit(size: image.ImageSize, maxWidth: number): image.ImageSize {
  const scale = Math.min(1, maxWidth / size.width);

  return { width: size.width * scale, height: size.height * scale };
}

const size = fit(await image.prefetch('https://example.com/map.png'), 320);

Type declaration

ts
export type ImageSize = { width: number; height: number };

Members 2

NameTypeRequiredDescription
widthnumberYes—
heightnumberYes—
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.