Make sure to allow Scratch to use your camera first. Press space to take a picture, and hold still for several minutes. The pictures are not saved to anywhere. No one besides you can see it. Right-click the canvas and select "Save image as..." to save your image.
For faster version: https://turbowarp.org/424751563?stuck The difference between this one and the original is that the pixels are shown as soon as they are scanned, not at the end. Credit to @griffpatch for the square-drawing code, and credit to @DadOfMrLog for the color detection code.