Description
Hi there, thank you for all the work so far on this super useful project!
Short overview
In addition to accepting a string path to an image file on disk, it would be very useful if screen.find
could accept a buffer with image data, so users can manipulate an image in memory (i.e. cropping with sharp) to provide to screen.find
, without having to write it to disk first.
Use case
I have a project where I'd like to store full screenshots of an application, and then use nut to find specific parts of the screenshot, identified by bounding box coordinates. This makes the screenshots easier to update since users can just screenshot the app and update the coordinate data without having to do any manual image cropping.
I was hoping to accomplish this by using sharp to crop the screenshots using the supplied coordinates, and then passing the result as a buffer to screen.find. Currently I'm working around this by writing the cropped output to a temporary file first before supplying to screen.find, which works, but is a bit clunky and inefficient. And in the long term, as I'm dealing with a lot of screenshots and plan on running on a device with eMMC storage, I worry that the repeated unnecessary writes could further reduce the flash storage lifespan.
I would be happy to work on a PR if this sounds like a useful addition! Thanks!