Introducing PixelGrid: It makes the canvas behave like an array (or matrix) of pixels

Hello!
I am a student here, I did the machine learning course and now I am doing Deep Learning which in the process I wrote this code that I would like to share with you guys as I find it nice and useful.

PixelGrid, a JavaScript class inspired by this deep learning course. The course’s lectures on image vectorization and RGB manipulation sparked the idea for transforming a standard HTML canvas element into a 2D array (or matrix) of pixels, with each pixel accessible or modifiable individually.

How Does It Work?

PixelGrid stores the canvas’s pixels in a 1D array in RGBA format. Each pixel is represented as an array of four integers (ranging from 0 to 255), signifying the red, green, blue, and alpha (transparency) values. PixelGrid provides methods for obtaining and modifying the color of individual pixels, thereby facilitating low-level image data manipulation.

Feel free to check it out and hopefully hear back from you.
npm install this.pixelgrid

In the project I have provided 2 demos demo.html and demo2.html,
demo2.html is nice as it gives you options to make it 2D or 3D and you get the array.

Note:
Students should be extremely cautious about installing software from unknown sources.