What is visual cryptography? Question:
1. What is visual cryptography?
2. How does it work for secret image sharing?   
Attempt: I have tried to understand the concept of secret image sharing for black and white pixel from here http://www.datagenetics.com/blog/november32013/. But I have doubt about pixel expansion in this case. Suppose I have a image $212\times 212$ pixels. How can I encode this image to use as cipher text using pixel.
I want to clear my doubt. Please help me to understand this?
 A: The rule is already given here:

Let $\begin{matrix}\blacksquare\square\\\square\blacksquare\end{matrix}$ be pattern 1 and $\begin{matrix}\square\blacksquare\\\blacksquare\square\end{matrix}$ be pattern 2.
Notice that they add up to a black square, and when added to themselves, they create a half-black square.
If the source pixel is black:


*

*For half of the time, give pattern 1 to the first encrypted image and pattern 2 to the second encrypted image.

*For the other half of the time, give pattern 2 to the first image and pattern 1 to the second.


If the source pixel is white:


*

*For half of the time, give pattern 1 to the first encrypted image and the second encrypted image.

*For the other half of the time, give pattern 2 instead.



Variations
As stated in the website, they do not have to be a checkerboard pattern.
As long as pattern 1 is the complement of pattern 2, i.e. they share no common black pixel and they add up to a large black pixel, then you can use them. You are also encouraged to use different varieties.

Program:
In Pyth:
J.z          "assign the inputs to J" \
=GmmO6lhJlJ  "assign G to an array filled with random" \
             "numbers from 0 to 5, each corresponding" \
             "to a pattern" \
=H.e.e?q@@JkY"■"-5ZZbG \
             "assign H to G, then flip the number if" \
             "the corresponding pixel is black"
jbms`MdG\
jbms`MdH     "print both arrays"

Try it online!
Correspondence:


*

*0 corresponds to $\begin{matrix}\blacksquare\blacksquare\\\square\square\end{matrix}$.

*1 corresponds to $\begin{matrix}\blacksquare\square\\\blacksquare\square\end{matrix}$.

*2 corresponds to $\begin{matrix}\blacksquare\square\\\square\blacksquare\end{matrix}$.

*3 corresponds to $\begin{matrix}\square\blacksquare\\\blacksquare\square\end{matrix}$.

*4 corresponds to $\begin{matrix}\blacksquare\square\\\blacksquare\square\end{matrix}$.

*5 corresponds to $\begin{matrix}\square\square\\\blacksquare\blacksquare\end{matrix}$.


They are deliberately assigned so that if their code add up to 5, then the pixels add up to a large black pixel.
