Encode/decode images using Base64 or shuffle/recover the pixels of images.
Project description
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:
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 图片混淆 in Python.
Installation
PixelPuzzle can be installed from PyPI:
pip install pixelpuzzle
or download the repository and run:
pip install .
as of the repository root folder.
Examples
-
The original image:
-
The shuffled image (using the random seed
0721): -
The recovered image:
Packaging
The binaries are created with
Nuitka
PyInstaller:
# Package it on Linux
pyinstaller --name PixelPuzzle --onefile -p pixelpuzzle pixelpuzzle/__main__.py
# Package it on Windows
pyinstaller --name PixelPuzzle --onefile --icon python.ico -p pixelpuzzle pixelpuzzle/__main__.py
Web Applications
Deploy Pixel Puzzle on Vercel.
Similar Projects
Here are some links to other similar projects that I am aware of:
Copyrights
PixelPuzzle is a free, open-source software package (distributed under the GPLv3 license). The sample image used is downloaded from satchely doki doki literature club! natsuki. The Python icon is downloaded from python.ico.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pixelpuzzle-1.0.5.tar.gz.
File metadata
- Download URL: pixelpuzzle-1.0.5.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e07def7a83c61a94f6b873b415e6da564e511d7743525533c1068f9a2e9d5cb
|
|
| MD5 |
4f478bb3ec3d024d3aa77afbfd8eadc2
|
|
| BLAKE2b-256 |
3453d349de2e86f13b0a99a24ab1a599c21ce1d3c6ba80fd4b88cd4725f4616b
|
Provenance
The following attestation bundles were made for pixelpuzzle-1.0.5.tar.gz:
Publisher:
python-publish.yml on ZhanZiyuan/PixelPuzzle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pixelpuzzle-1.0.5.tar.gz -
Subject digest:
7e07def7a83c61a94f6b873b415e6da564e511d7743525533c1068f9a2e9d5cb - Sigstore transparency entry: 424217768
- Sigstore integration time:
-
Permalink:
ZhanZiyuan/PixelPuzzle@9bfa23b8d65391ad055bd6199eea3d172fd419ee -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/ZhanZiyuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@9bfa23b8d65391ad055bd6199eea3d172fd419ee -
Trigger Event:
release
-
Statement type:
File details
Details for the file pixelpuzzle-1.0.5-py3-none-any.whl.
File metadata
- Download URL: pixelpuzzle-1.0.5-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bb3cf0693ce6cbf13896d9cbce5faaa41fd67a0e2e7b54d50cf3126f80406a5
|
|
| MD5 |
80d271678e75a92d089714f658baa198
|
|
| BLAKE2b-256 |
5623797f8f6d5e8d7c0365141fca54915274cda51458666e6b5621fdb8d38fe1
|
Provenance
The following attestation bundles were made for pixelpuzzle-1.0.5-py3-none-any.whl:
Publisher:
python-publish.yml on ZhanZiyuan/PixelPuzzle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pixelpuzzle-1.0.5-py3-none-any.whl -
Subject digest:
7bb3cf0693ce6cbf13896d9cbce5faaa41fd67a0e2e7b54d50cf3126f80406a5 - Sigstore transparency entry: 424217789
- Sigstore integration time:
-
Permalink:
ZhanZiyuan/PixelPuzzle@9bfa23b8d65391ad055bd6199eea3d172fd419ee -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/ZhanZiyuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@9bfa23b8d65391ad055bd6199eea3d172fd419ee -
Trigger Event:
release
-
Statement type: