Skip to main content

Function: cropImage()

cropImage(imageSource, boundingBox): Promise<string>

Defined in: src/camera/CameraUtils.ts:234

Asynchronously crops an image (provided as a base64 string or ImageData) using a THREE.Box2 bounding box. This function draws a specified portion of the image to a canvas and returns the canvas content as a new base64 string.

Parameters

imageSource

The source image as a base64 string or ImageData object.

string | ImageData

boundingBox

Box2

The bounding box with relative coordinates (0-1) for cropping.

Returns

Promise<string>

A promise that resolves with the base64 string of the cropped image.