Skip to main content

A program for encoding information in image and audio files through steganography.

Project description

stegpy

A program for encoding information in image and audio files through steganography. Any type of data can be encoded, from raw strings to files, as shown below:

On the left, a house with a steganographically hidden image. On the right, the extracted hidden image of a cat. It is revealed by removing all but the least significant bit of each color component in the host image.


Supported host formats

  • JPEG
  • PNG
  • BMP
  • GIF
  • WebP
  • WAV

JPEG hosts use DCT-coefficient embedding. On the CLI, other Pillow-readable image formats are converted to PNG when saved. The web API accepts only the formats listed above. WAV is the only supported audio format.


Dependencies

  • numpy
  • cryptography
  • Pillow (PIL fork)
  • jpeglib
  • FastAPI
  • python-multipart
  • Uvicorn

Installation

Install or upgrade the current release from PyPI with Python's package manager:

 python -m pip install --upgrade stegpy
 stegpy -h

For development, clone the repository and create the environment with uv:

 git clone https://github.com/izcoser/stegpy.git
 cd stegpy
 uv sync --dev
 uv run stegpy -h

Usage:

Hide a message or file:

 stegpy "Hello World!" image.png

Extract it:

 stegpy _image.png

Data is encoded without any protection by default, but it can be encrypted with the -p flag:

Encrypt:

 stegpy "Hello World!" image.png -p
Enter password (will not be echoed):
Verify password (will not be echoed):
 stegpy _image.png -p
Enter password (will not be echoed):
Hello World!

More options:

 stegpy -h

Live demo

A live demo backed by the Python package is available at https://stegpy.coseri.xyz.

Run the FastAPI application and browser demo locally from the repository:

 uv run uvicorn stegpy.web:app --reload

Then open http://127.0.0.1:8000. The static files in web-demo/ require the FastAPI /api/* backend and do not work by opening index.html directly.

The hosted demo supports PNG, BMP, GIF, WebP, WAV, and JPEG hosts, text or file payloads, and optional password encryption. Host and file payload uploads are limited to 20 MB; text messages are limited to 1 MB. Its capacity display shows usable payload bytes after the stegpy header, embedded filename, and encryption overhead.

The API also exposes GET /api/health, POST /api/capacity, POST /api/encode, and POST /api/decode. Interactive API documentation is available at http://127.0.0.1:8000/docs when running locally.


Support

Donations are appreciated if you find this project useful.

Ethereum / EVM: 0xfE1039ba2d4973eb6F6dd1cF3BDAF24aa6cbff96

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

stegpy-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stegpy-0.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file stegpy-0.1.0.tar.gz.

File metadata

  • Download URL: stegpy-0.1.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for stegpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ae48669fd121564540217861ebb8667bc29d9a0cd765d64943b157bbd43aaa9
MD5 ae49c619d5a15da55dc8f9cb40528c91
BLAKE2b-256 bd61216f9a33216e8672a0b2e4f8b68ff9fd24ec2123a707c1c45930f5ddc068

See more details on using hashes here.

File details

Details for the file stegpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stegpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for stegpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66af8f788cf8432e6c44371d65053348bb29043738042770e3fcd8a91be7516d
MD5 c29eb72ce4c0a6e5d3b3e3c4a8b682b8
BLAKE2b-256 a39391981214544917c78e13ffd3dae310c06f3765091acf4730de87812f1cdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page