Split image into tiles and scramble/unscramble them with seed.
Project description
Pycasso
Split image into tiles and scramble/unscramble them based on a seed. The demo application can be found at https://image-scramble.herokuapp.com.
Scramble
Using scramble mode on this sample image will produce the following output:
Unscramble
To revert the image to its original state, use the same seed
and slice_size
on unscramble mode.
Credits
-
Pycasso is a Python version of webcaetano/image-scramble and webcaetano/shuffle-seed. This also uses a stripped-down port of davidbau/seedrandom to initialize the PRNG.
-
Sample image is taken from Pepper&Carrot by David Revoy licensed under CC BY 4.0.
Setup
Install from PyPI
$ pip install image-scramble
Install from source
- First, you should get a copy of this project in your local machine by either downloading the zip file or cloning the repository.
git clone https://github.com/catsital/pycasso.git
cd
intopycasso
directory.- Run
python setup.py install
to install package.
Usage
Web application
- Run
python app/app.py
Docker
- Build from local using:
$ docker build -t "image-scramble" .
$ docker --name pycasso -p 5000:5000 -d image-scramble
- Get image from Docker Hub:
$ docker pull catsital/image-scramble
Command-line utility
$ pycasso image_input.png image_output scramble
This will produce a scrambled image with seed based on your current system time. Hence, the output will be completely unpredictable and irreversible. Use the options -n
for slice_size
, -f
for format
, and -s
for seed
, like so:
$ pycasso image_input.png image_output scramble -n 50 50 -s seed -f jpeg
Script
Initialize a Canvas
and use scramble on export
by:
from pycasso import Canvas
Canvas('image_input.png', (30, 30), 'seed').export('scramble', 'image_output', 'jpeg')
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
File details
Details for the file image-scramble-2.1.2.tar.gz
.
File metadata
- Download URL: image-scramble-2.1.2.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4144307df79deb318b75b5c6d8ffc6f0926a5a86cfcfc1f79835834df6f61194 |
|
MD5 | c352847bb7575197583f1b9fe42acaba |
|
BLAKE2b-256 | a35a201b5df26b12d08ca35b455fd3dd8bbdb6a7d3c4e11565591611c3c3c0ac |
Provenance
File details
Details for the file image_scramble-2.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: image_scramble-2.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa5dd0feebca9692d4238c501973c1feb2c45e1ab33cd99bb3947ee553b806af |
|
MD5 | db577617dc70812aa57d0e9fca8c8702 |
|
BLAKE2b-256 | 3047018e028267d95e76162ab5fa36d1a193f7435afb1ac2d69e4cfa7b611d58 |