Skip to main content

logo

PixelPuzzle

GitHub Actions Workflow Status GitHub last commit PyPI - Python Version PyPI - Version PyPI - Wheel PyPI - Downloads GitHub License

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 original image

  • The shuffled image (using the random seed 0721):

    The shuffled image

  • The recovered image:

    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.

Metadata

Release files for pixelpuzzle 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pixelpuzzle 1.0.5
File Size Uploaded Provenance
pixelpuzzle-1.0.5.tar.gz 17.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pixelpuzzle 1.0.5
File Interpreter ABI Platform
pixelpuzzle-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 36.1 kB

Release files / pixelpuzzle-1.0.5.tar.gz

Download URL pixelpuzzle-1.0.5.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e07def7a83c61a94f6b873b415e6da564e511d7743525533c1068f9a2e9d5cb
BLAKE2b-256 checksum
How to use checksums
3453d349de2e86f13b0a99a24ab1a599c21ce1d3c6ba80fd4b88cd4725f4616b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2025.

Transparency log

Release files / pixelpuzzle-1.0.5-py3-none-any.whl

Download URL pixelpuzzle-1.0.5-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bb3cf0693ce6cbf13896d9cbce5faaa41fd67a0e2e7b54d50cf3126f80406a5
BLAKE2b-256 checksum
How to use checksums
5623797f8f6d5e8d7c0365141fca54915274cda51458666e6b5621fdb8d38fe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2025.

Transparency log

Security for pixelpuzzle 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pixelpuzzle-1.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page