I am trying to add a transparent image on an existing image
I tried below:
import cv from "@u4/opencv4nodejs";
const image = await cv.imreadAsync(SCREENSHOT_PATH); // jpg
const grid = await cv.imreadAsync(GRID_IMAGE_PATH); // png
const roi = image.getRegion(new cv.Rect(520, 165, 561, 564));
await grid.copyToAsync(roi);
await cv.imwriteAsync(OUTPUT_PATH, image);
While this adds the image, it does not preserve transparency