Skip to main content

Function: hasImageSupport()

hasImageSupport(runtime): runtime is Runtime & { images: ImageAPI }

Defined in: packages/core/src/runtime.ts:457

Check if runtime has image processing support

Parameters​

runtime​

Runtime

Runtime instance to check

Returns​

runtime is Runtime & { images: ImageAPI }

True if image support is available

Remarks​

Type guard to check if the current runtime supports PNG/GIF rendering. Use this before accessing runtime.images to avoid runtime errors.

Example​

const runtime = getRuntime();

if (hasImageSupport(runtime)) {
// TypeScript knows runtime.images exists here!
const png = runtime.images.png.PNG.sync.read(buffer);
}