Why is padStart not working for data from context.getImageData array?

18 Views Asked by At

I am having trouble trying to get the hex value of a pixel. I found some code from an example and I began debugging only to find that toString(16) didn't always output the correct number and padStart(2, "0") had absolutely no affect. I tried to make my own list and it worked fine, I tried an individual number and it worked fine, however when I use data from context.getImageData() it just doesn't produce the expected result at all.

I have made a jsbin that further shows the issue. Just upload an image, scroll down, and look at the output.

0

There are 0 best solutions below