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
Hashes for image_scramble-2.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa5dd0feebca9692d4238c501973c1feb2c45e1ab33cd99bb3947ee553b806af |
|
MD5 | db577617dc70812aa57d0e9fca8c8702 |
|
BLAKE2b-256 | 3047018e028267d95e76162ab5fa36d1a193f7435afb1ac2d69e4cfa7b611d58 |