SkillAgentSearch skills...

Scrambpy

Scramb.py is a region based JPEG Image Scrambler and Descrambler written in Python for End-to-End-Encrypted (E2EE) Image distribution through unaware channels.

Install / Use

/learn @snekbeater/Scrambpy

README

Scramb.py

Scramb.py is a region based JPEG Image Scrambler and Descrambler written in Python for End-to-End-Encrypted (E2EE) Image distribution through unaware channels.

Current version: 0.5.0 from 2022-06-16 is out!

New: Cloak mode! Try it out!

New: Scramp.py Studio - create masks with a GUI!

Start now:

How it works:

Upcoming Features:

Examples:

Use cases

Avoid report systems

  • Offend the easily offended less: Upload pictures to sites like Twitter, Facebook, DeviantArt etc. (esp. Social Media) that normally trigger people to report these despite being okay and according to TOS of the site.

Secure your images

  • Upload a pic as a teaser but give away the password only to a small section of people
  • Have a gallery with images showing no sign of a second meaning and distribute the patch images separatly.

Avoid automated scanning like European Union's chatcontrol

  • Use as End-to-End-Encryption E2EE method for websites, messaging systems, chats, email, etc.
  • Image Hosts / Websites / Chat & Messaging services are left unaware of image content
  • Prevent and circumvent automated scanning / image hashing / photo hashing and machine learning / AI recognition of images. Scramb.py helps bringing back the effort of scanning and analysing images to a manual and thus expensive, labor intensive level. It thus helps to prevent mass surveillance. Scramb.py builds another layer of encryption if E2EE of messaging services should be crippled or broken by new laws.
  • In comparison to encryption on binary level (ZIP with Password, VeraCrypt Container, PGP), Scramb.py retains a JPEG / an image that can be uploaded to a lot of websites and messaging platforms. Binary encrypted content cannot be uploaded there.

Main Features

  • Scramb.py can scramble images regions. So you can e.g. scramble only the face of a person.
  • All you need to descramble the image is encoded in a data „snake“ around the image. The scrambled image is thus a bit wider as the original.
  • You can select different scramble modes.
    • When you slightly scramble a region, a thumbnail of the image can still be recognized.
    • If you use the ultra scrambler, you cannot guess the content.
  • You can set a password
  • You can scramble and descramble images using GnuPG PKI public key infrastructure
  • You can include short text messages that will show up upon descramble
  • Easy to use: Windows Drag & Drop descramble
  • Survives multiple re-encodings of an image down to JPEG quality around 30 something, when the image gets ugly and blocky still chances that they decode
  • You can create patch images to separate transported images from their recreation metadata
  • Does not depend on any binary meta data within the JPEG file (EXIF, XMP, IPTC), as these are normally completly stripped by all major social media sites.

How it looks

Regional scrambled Image

In this example, only Lenna's face was scrambled and the scrambled image is password protected. You can actually try the example images in this repo with scramb.py yourself! Also, people get offended when Lenna is used (although, now we also have Fabio, which I use as a Black/White Test Image!... so, Lenna is scrambled here in this repo :-)

Usage in Online Galleries

You can host your scrambled images out of sight, out of censorship and out of reporting systems and automated scanning on different online image services!

As an example, some images are hosted on PostImages Image Hosting Service.

Head over to this gallery https://postimg.cc/gallery/bh5Zf9J to see all of the Kodak Example Images scrambled with scramb.py!

Patch for another Image

This is a patch image. Scramb.py can create these to separate transported images from their recreation metadata. The patch image is then used to "patch in" the scrambled image blocks next to the thumbnail you see here.

Scramb.py Studio

Warning

As long as it is hacking-fun to circumvent scanning and reporting, you are invited to try out scramb.py!

BUT

Scramb.py should not be used in real-world situations that require encryption and your life or personal wealth rely on it. It is only intended for demonstration and experimentation. If you need strong message and image encryption, do not use Scramb.py! Use a well-regarded, open-source OpenPGP implementation such as GnuPG or encryption systems like VeraCrypt.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Installation

Windows

scramb.py is written and runs in Python, so you have to install the Python interpreter and one Python module (Pillow).

  1. Install Python 3 for Windows https://www.python.org/downloads/windows/
  2. Download scramb.py Script, it should look like this:

  1. (Optional) Download scrambpystudio.py, if you want to use a GUI for scramb.py. Place scrambpystudio.py in the same directory as scramb.py.

  2. Install Pillow module, you can do this manually or let the scramb.py Script do this:

    • via Script: Run scramb.py with a double click and if prompted, press y to install Pillow
    • manually locate pip.exe in your Python installation folder and run pip.exe install Pillow in a commandline

Linux

  1. Install Python 3 if not already present (Ubuntu, Raspberry OS etc should have Python 3 installed already).
  2. Download scramb.py Script
  3. (Optional) Download scrambpystudio.py, if you want to use a GUI for scramb.py. Place scrambpystudio.py in the same directory as scramb.py.
  4. If not present, install Pillow with pip install Pillow
  5. Make the script executable chmod +x scramb.py

Usage

Descramble

Drag & Drop Descramble (Windows)

To descramble an image, download it in full resolution and drag & drop it onto the script.

  • If the image is password protected, the console window will stay open and ask you for a password:

  • At this point you cannot descramble patch-mode images with drag & drop (the one where you input 2 images). You then have to use the commandline.

Descramble (Windows)

To descramble an image, download it in full resolution and use its path as one of the arguments python.exe scramb.py <inputfile.jpg>

python.exe scramb.py -i <inputfile.jpg> -o <outputfile.jpg>

Descramble (Linux)

To descramble an image, download it in full resolution and use its path as one of the arguments ./scramb.py <inputfile.jpg>

./scramb.py -i <inputfile.jpg> -o <outputfile.jpg>

Patch Mode Descramble (Windows)

python.exe scramb.py -i <patchfile> -d <disguisefile> -o <outputfile.jpg> [OPTIONS]

Patch Mode Descramble (Linux)

./scramb.py -i <patchfile> -d <disguisefile> -o <outputfile.jpg> [OPTIONS]

Scramble

Scramble (GUI based with Scramb.py Studio)

Note that Scramb.py Studio is in its first release and pretty much featureless. If you want more than basic scramble, you as of now have to use the commandline.

  1. Start scrambpystudio.py with double click or via commandline.
  2. Open the image to be scrambled
  3. Draw masked area. It will appear red. You can change brush type (circle / rectangle) and its size. Left mouse button draws, right mouse button erases but you can switch that around with the brush and eraser buttons.
  4. Select Scramble/Export scrambled image...

Two Images will be saved in the same directory as the loaded image <filename>:

  • ORIGINALFILENAME_scst_mask.png
  • ORIGINALFILENAME_scst_scrambled.jpg

As of now you cannot change these filenames nor is any error given if somehow something (within scramb.py) fails.

The image is scrambled using ultra scrambler and the -2 option. You again cannot change that as of now.

Scramble (Windows)

python.exe scramb.py -i <inputfile> [-m <mask.png/.jpg>] -o <outputfile.jpg> [OPTIONS]

You must use -m and/or -s for scramb.py to detect that you want to scramble.

Scramble (Linux)

./scramb.py -i <inputfile> [-m <mask.png/.jpg>] -o <outputfile.jpg> [OPTIONS]

You must use -m and/or -s for scramb.py to detect that you want to scramble.

Scramble with GnuPG PKI (Linux)

./scramb.py -i <inputfile> [-m <mask.png/.jpg>] -o <outputfile.jpg> -s pki -k <key-id> [OPTIONS]

Create GnuPG Public Key Image (Linux)

./scramb.py --export-public-key <key-id> -i <center-image> -o <outputfile.jpg>

Creates a "business card" image that features <center-image> in the middle surrounded by your public key within the data snake. The public key is exactly the same type as the one you would use for an encrypted email correspondance.

Import GnuPG Public Key Image into your keyring (Linux)

./scramb.py <publicKeyImageFile.jpg>

A menu will ask you what you want to do with the public key (import in keyring, export into .asc file).

Patch Mode Scramble (Windows)

python.exe scramb.py -i <inputfile> -d <disguisefile> -m <maskfile> -o <patchfile.jpg> [OPTIONS]

Patch Mode Scramble (Linux)

./scramb.py -i <inputfile> -d <disguisefile> -m <maskfile> -o <patchfile.jpg> [OPTIONS]

Create Mask Image (GUI based with Scramb.py Studio)

Note that Scramb.py Studio is in its first release and pretty much featureless.

  1. Start scrambpystudio.py with double click or via commandline.
  2. Open the image to be scrambled
  3. (Optional) Open an existing mask png image
  4. Draw mask

Related Skills

View on GitHub
GitHub Stars59
CategoryDevelopment
Updated2mo ago
Forks2

Languages

Python

Security Score

100/100

Audited on Jan 13, 2026

No findings