Struggling with reading pixels...

Alright, I'm working on a simple tool that can hide a message in an image. It's some simple functionality, and I've got the basics of it running. However, I have an error I can't figure out for the life of me and I'm wondering if it's a quick of p5js or me being dumb. There are two pages, one that puts the message in the image and one that extracts it. I'm having trouble with extracting the image. Most of it will come out properly, but then one bit will get off and corrupt the entire message.

This doesn't happen with every image or all the time, but this is an example where it does. The decoding page reads the pixel values incorrectly in three spots, which are shown in the console. I was wondering if anybody might have a clue as to why this isn't working? Again, I'm new to p5 JS so please go easy on my.

[Here is a link to a google drive folder with the image file as well as the html and javascript. ] (https://drive.google.com/drive/folders/1y_WfPAN6zHfV6a3eS-GvxBQJw0kXy2FZ?usp=sharing)

Tagged:
Sign In or Register to comment.