Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / imageResourceFromBuffer

Function: imageResourceFromBuffer()

imageResourceFromBuffer(buffer): ImageResource

Defined in: botjs/src/image-match.ts:165

Create an image resource from a Buffer

Parameters

buffer

Buffer

PNG, JPG, or other image format buffer

Returns

ImageResource

ImageResource

Example

typescript
import { imageResourceFromBuffer, findOnScreen, captureScreenRegion } from "@tego/botjs";

// Capture a region and use it as template
const capture = await captureScreenRegion(100, 100, 50, 50);
const template = imageResourceFromBuffer(capture.image);
const matches = await findAllOnScreen(template);

Released under the MIT License.