Skip to main content

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 the current release from PyPI as a command-line tool with uv:

 uv tool install stegpy
 stegpy -h

Upgrade an existing install with:

 uv tool upgrade stegpy

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

Metadata

Release files for stegpy 0.2.0

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

Source distribution (sdist)

Source distribution for stegpy 0.2.0
File Size Uploaded Provenance Actions
stegpy-0.2.0.tar.gz 26.7 kB Without provenance Details for stegpy-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 49.7 kB

Release files / stegpy-0.2.0.tar.gz

Download URL stegpy-0.2.0.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
34a0ea0152213c911172a0bc48b26e8ddc00560860f456db83d8e1dce1b3db0c
BLAKE2b-256 checksum
How to use checksums
4d40ed1012b3f8f3db158536e48845f4e862cfa45ff9e5e218a858f7cf7c0367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / stegpy-0.2.0-py3-none-any.whl

Download URL stegpy-0.2.0-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7844b2a4fb3b1c239eecfe256c50cb46dfc58eced0d129850de41ec7519c31d1
BLAKE2b-256 checksum
How to use checksums
53c2be5e265b6162b95201d59cd6844da1b44d351e2e7732d12aef72febe7ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Security for stegpy 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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