I am building an Electron app. There is a need to have a color picker so I want to build an eye-drop style color picker. I got some hints that robot.js and paper.js might be helpful so I checked them. I'd like to, kind of, combine them together. I use robot.js to get the screen capture with a format of
bitmap {
width: 2560,
height: 1600,
byteWidth: 10240,
bitsPerPixel: 32,
bytesPerPixel: 4,
image: <Buffer d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 cf cd ff cf cf cd ff cf cf cd ff cf cf cd ff cf cf cd ff cf cf ... >,
colorAt: [Function] }
I'd like to display this bitmap as an image (maybe with a HTML img tag). Then I will be able to build a Raster (paper.js) for the eye drop and mouse event listening.
However, I did not find a way to convert this image buffer to an actual image.
Any help is appreciate!
https://nodejs.org/dist/latest-v6.x/docs/api/buffer.html#buffer_buf_tostring_encoding_start_end