Metadata-Version: 2.4
Name: pixelpuzzle
Version: 0.4.1
Summary: Encode/decode images using Base64 or shuffle/recover the pixels of images.
Author-email: Zhan Ziyuan <ziyuanzhan@mail.nankai.edu.cn>
Maintainer-email: Zhan Ziyuan <ziyuanzhan@mail.nankai.edu.cn>
License: GNU GPLv3
Project-URL: Homepage, https://github.com/ZhanZiyuan/PixelPuzzle
Project-URL: Bug Tracker, https://github.com/ZhanZiyuan/PixelPuzzle/issues
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.2.4
Requires-Dist: pillow>=11.1.0
Dynamic: license-file

# PixelPuzzle

Encode/decode images using Base64
or shuffle/recover the pixels of images.

## Motivations

This repository is a renewed implementation
of Python code I saw a long time ago on [CoolApk](https://www.coolapk.com/):

```python
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image

# Get the three-dimensional pixel channel matrix of the image
img = np.array(Image.open("C:/Users/user/Downloads/test.png"))
# First dimension
row_len = img.shape[0]

# Shuffle the dimension indices
row_index = np.random.permutation(row_len)
# Generate the chaotic image
img_chaos = img[row_index, :, :]

# Use sorting to unshuffle the image
img_sort = img[np.sort(row_index), :, :]

# Plot the chaotic and unshuffled images
plt.figure('Chaotic and Unshuffled Images')
plt.subplot(121)
plt.imshow(img_chaos)
plt.subplot(122)
plt.imshow(img_sort)
plt.show()
```

And it can also be seen as an implementation
of similar functions of the Android application
[图片混淆](https://www.coolapk.com/feed/27933328?shareKey=N2QxMWY3MTExMDc0NjY0OWQwYWE)
in Python.

## Examples

- The original image:

    ![The original image](./images/original.png "original")

- The shuffled image (using the random seed `0721`):

    ![The shuffled image](./images/shuffled.png "shuffled")

- The recovered image:

    ![The recovered image](./images/recovered.png "recovered")

## Packaging

The binaries are created with
~~[Nuitka](https://github.com/Nuitka/Nuitka)~~
[PyInstaller](https://github.com/pyinstaller/pyinstaller).

## Web Applications

Deploy [Pixel Puzzle](https://pixelpuzzle-web.vercel.app/)
on [Vercel](https://github.com/vercel/vercel).

## Similar Projects

Here are some links to other similar projects that I am aware of:

- [PicEncryptApp](https://github.com/goldsudo/PicEncryptApp)
- [piConfuse](https://github.com/Conyrol/piConfuse)
- [Jencryption](https://github.com/Jinnrry/Jencryption)
- [RicEncrypt](https://github.com/NaviHX/ricencrypt)

## Copyrights

PixelPuzzle is a free, open-source software package
(distributed under the [GPLv3 license](./LICENSE)).
The sample image used is downloaded from
[satchely doki doki literature club! natsuki](https://yande.re/post/show/465068).
