Closed philmirez closed 5 years ago
Hello 👋
I would like to compare two images in memory as opposed to relying on reading and writing from the file system.
I might be going about this the wrong way and if so I'd appreciate some sort of hint/help.
I've created a repo showcasing what I'm seeing: https://github.com/philmirez/comparing-buffers
examples/diff.png
examples/prodScreenshot.png
examples/stagingScreenshot.png
Side note: One thing that threw me off was when I was reading the pixelmatch/index.js file, it says...
pixelmatch/index.js
if (img1.length !== width * height * 4) throw new Error('Image data size does not match width/height.')
I don't understand why width and height are being multiplied by 4.
width
height
Never mind, I was able to find help on stackoverflow.
Hello 👋
I would like to compare two images in memory as opposed to relying on reading and writing from the file system.
I might be going about this the wrong way and if so I'd appreciate some sort of hint/help.
I've created a repo showcasing what I'm seeing: https://github.com/philmirez/comparing-buffers
examples/diff.png
)examples/prodScreenshot.png
andexamples/stagingScreenshot.png
).Side note: One thing that threw me off was when I was reading the
pixelmatch/index.js
file, it says...I don't understand why
width
andheight
are being multiplied by 4.