A library that converts canvas to bmp - bitmap image per pixel
npm i canvas-to-bmp
It is good to use my primary library that it does the conversion from dom to canvas
npm i html-canvas-ts
After you get the result,
The library above returns:
canvas, ctx, you can get the width and hight from canvas like: canvas.width or canvas.height
and than you can call the method optimized bellow:
****************************************
const result: number[] = convertCanvasToBmp(ctx, width, height);
****************************************
This return 1 (0) and 0 (255), 1 if the pixel is black and 0 if the pixel is white
Clone the seed app with
git clone [email protected]:BeratS/canvas-to-bmp.git
It's tested on latest Chrome(102) and Firefox(100), Safari(15), Cog Browser
https://twitter.com/BeratSdev
https://linkedin.com/in/berat-sulimani
Create an issue of what are your needs of this library.
Feel free to chat with me.