I am new to JavaScript/Node.js and image processing and would like to take the output of puppeteer screenshot (preferably in memory) then be able to traverse colors of each pixel in the image, then stroke a rectangle border around certain coordinated of the image (x, y, width, height), then write save the image with the rectangle highlights to file using Node.js.
What I get from puppeteer is
returns:
<Promise<string|Buffer>>
Promise which resolves to buffer or a base64 string (depending on the value of encoding) with captured screenshot.
I read that I can create a canvas object using puppeteer to do this but I am not sure about this solution especially to retrieve pixel colors. I don't know if I should be using a package like PureImage for this or some other package.