Skip to main content

Function: cropImage()

cropImage(base64Image, boundingBox): Promise<string>

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

Asynchronously crops a base64 encoded image using a THREE.Box2 bounding box. This function creates an in-memory image, draws a specified portion of it to a canvas, and then returns the canvas content as a new base64 string.

Parameters

base64Image

string

The base64 string of the source image. Can be a raw string or a full data URI.

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.