Actually, it's fairly simple:
Generate an image with random pixelation; that is, each pixel is either black or white with probability 1/2. We'll call this image 1.
Exclusive-or image 1 with the target to generate image 2; so that a pixel image 2 will be white if the pixels in image 1 and the target are the same (both with or both black), and black if they differ.
Now, you combine the two images by overlaying them; what this effectively does is an AND function, in the sense that a pixel in the combined image will be white only if both image 1 and image 2 are white.
Now, if we have an area of pixels in the target image which are black, then when we combine those images, that area will be black as well. That's because, of any pixel in that area, either the pixel in image 1 will be black, or the pixel in image 2 will be black.
In contrast, if we have an area of pixels in the target image which are white, then when we combine those images, that area will be gray (likely consist of half white and half black pixels). Any pixels that happen to be black in image 1 will, of course, be black; any pixels that happen to be white in image 1 will also be white in image 2; as image 1 was random, this results in a gray area.