# Integrating Visual Cryptography for Efficient and Secure Image Sharing on Social Networks
## 3 Proposed Method
### Pixel Expansion Elimination  
In the original \(2\times 2\)-VCS, each secret pixel is encrypted into four sub-pixels, so the width and height of the decoded image are twice those of the secret image. This means that the carriers to conceal secret information are frequently four times larger than the information itself. Pixel expansion means that the size of the secret image cannot be too large; otherwise, it is difficult to align and superimpose the printed shares. The restored image cannot be used in the recognition system. To address this, we propose a non-extended VCS that utilizes downsampling preprocessing. This method reduces the size of the cost-secret image through downsampling, compensating for the expansion issue of the decrypted image that arises when each secret pixel is encrypted into four sub-pixels. Downsampling filtering can reduce the resolution or size of images. It achieves this by removing certain pixels from the image, thereby decreasing the amount of information contained in it. Downsampling filtering typically consists of two steps: filtering and sampling. As shown in Equation (9), before downsampling, it is necessary to filter the image to remove high-frequency noise and details. These filters can be implemented by averaging, weighted averaging, or calculating the median of pixel values in local regions of the image. After filtering, the image is sampled by selecting specific pixels from the filtered image. The sampling method can be as simple as selecting one pixel every few pixels, or it can follow certain rules. Common sampling methods include nearest-neighbor sampling, bilinear interpolation, and bicubic interpolation. Nearest interpolation finds the nearest point from the original image matrix and then compares the pixel value of the nearest point. This will produce an obvious sawtooth. As shown in Equation (9), bilinear interpolation no longer directly considers the nearest point, but four points \(V1\sim 4\) close to it, and then it distributes the weight through the proportion of the area. \[ \begin{array}{rl}f(x,y)=&\frac{f(V_{1})}{(x_{2}-x_{1})(y_{2}-y_{1})}(x_{2}- x)(y_{2}-y)\\ +&\frac{f(V_{2})}{(x_{2}-x_{1})(y_{2}-y_{1})}(x-x_{1})(y_{2}-y)\\ +&\frac{f(V_{3})}{(x_{2}-x_{1})(y_{2}-y_{1})}(x_{2}-x)(y-y_{1})\\ +&\frac{f(V_{4})}{(x_{2}-x_{1})(y_{2}-y_{1})}(x-x_{1})(y-y_{1})\end{array}  \tag{9}\]  
where \(f(x,y)\) denotes the current pixel. \((x_{2}-x)(y_{2}-y)\) denotes the total area. Note that we first downsample the image \(I\) with the size of \(W,H\) to \(W/2,H/2\) by the bilinear interpolation algorithm, and then reuse the existing basic encryption matrix of VCS to encrypt the image. Because one pixel is encrypted into four pixels, the decrypted image size is \(W/2\times 2=W,H/2\times 2=H\), and the decrypted image and the secret image size are the same. The circular nature of the Gaussian kernel allows it to better preserve edge information in multiple directions compared to other uniform blur filters. This is evident in convolution operations, where the Sobel operator can only extract vertical or horizontal edges [19]. The Gaussian kernel provides effective smoothing. Common applications include image blurring and downsampling, where low-pass filtering is essential beforehand to prevent false high-frequency information in the sampled image. The flowchart in Algorithm 1 illustrates an integrated VCS for efficient and secure image sharing. The process begins with a secret image \(I\) of size \(W\times H\) and weighting factors \(w_{t}\) and \(w_{g}\). The first step involves preprocessing, where the image is downsampled using bilinear interpolation and transformed into a halftone image \(I_{h}\) through iterative error diffusion and optimization of the objective function. Next, encryption matrices \(C_{0}\) and \(C_{1}\) are generated for white and black pixels based on predefined basis matrices. Finally, the halftone image \(I_{h}\) is encrypted pixel-by-pixel using these matrices to produce the encrypted image \(I_{e}\).