SteganoScript
A TypeScript-based steganography application that enables message hiding within digital images. Developed as part of Digital Image Processing coursework, this CLI tool implements advanced pixel manipulation techniques to embed and extract text messages while maintaining visual integrity.

Contents
🛠️ Technologies
Built with:
🚀 Getting Started
Prerequisites
Before running the application, ensure the following tools are installed:
Installation & Setup
# Clone the repository
$ git clone https://github.com/RiadOliveira/SteganoScript.git
# Navigate to project directory
$ cd SteganoScript
# Install dependencies
$ npm install
CLI Usage
SteganoScript offers a powerful CLI with comprehensive options for image steganography operations:
Encoding Mode
Embed secret messages into images with these options:
| Option | Alias | Required | Description |
|---|
--mode encoding | -m | Yes | Set operation mode to message embedding |
--imagePath <path> | -i | Yes | Path to carrier image (JPG/PNG) |
--pathMessage <path> | -p | Conditional* | Path to .txt file containing secret message |
--directMessage "text" | -d | Conditional* | Direct text input of secret message |
--outputFileName <name> | -o | No | Custom output filename (default: "outputFile") |
*Either pathMessage or directMessage required for encoding.
Decoding Mode
Extract hidden messages from images:
| Option | Alias | Required | Description |
|---|
--mode decoding | -m | Yes | Set operation mode to message extraction |
--imagePath <path> | -i | Yes | Path to encoded image file |
--outputFileName <name> | -o | No | Custom output filename for extracted message |
Important Notes
- Output files are saved in the /outputs directory by default.
- Supported image formats: JPG, PNG.
- Maximum message capacity depends on image dimensions.
- During encoding, original image dimensions are preserved.
📊 Methodology
Encoding Process
- Pixel Hashing: Each pixel is converted to a character code using the weighted formula:
(1 × R + 5 × G + 20 × B) % 256.
- RGB Adjustment: If needed, RGB values are incrementally adjusted to match target characters.
- Positioning: Starting pixel is calculated based on image dimensions using Euler's constant.
- Distribution: Message is spread across image using a cyclic jump pattern (2,4,6,8 pixels).
- Validation: Strict bounds checking ensures all RGB values remain within 0-255 range.
Decoding Process
- Initial Position: Same Euler-based calculation locates first encoded pixel.
- Pattern Recognition: Cyclic jump sequence reconstructs original message distribution.
- Character Extraction: Weighted hashing converts RGB values back to ASCII characters.
- Message Reconstruction: Header metadata ensures accurate message length recovery.
📂 Project Structure
SteganoScript/
├── outputs/ # Generated encoded images and decoded messages
├── temp/ # Temporary files for processing
├── src/
│ ├── constants/ # RGB weights and operational constants
│ ├── decoding/ # Message extraction logic
│ ├── encoding/ # Message embedding logic
│ ├── error/ # Custom error handling
│ ├── types/ # TypeScript interfaces
│ ├── utils/ # Core operations and validations
│ └── main.ts # CLI entry point
├── .eslintrc # Code style configuration
├── package.json # Project dependencies
└── tsconfig.json # TypeScript configuration
⚙️ Features
- Imperceptible Alterations - Minimal RGB adjustments ensure visual integrity of carrier images.
- Weighted Hashing Algorithm - Proprietary RGB weighting system (1:5:20 ratio) for character encoding.
- Adaptive Pixel Selection - Intelligent pixel distribution using Euler-based positioning and cyclic jumps.
- CLI Interface - Simple command-line operation for easy integration into workflows.
- Dual Input Modes - Accept messages via text files or direct CLI input.
- Input Validation - Comprehensive checks for file paths and required arguments.
- Help System - Built-in documentation with
--help flag.
- Error Handling - Clear error messages for invalid operations.
🔧 Usage Examples
Basic Encoding
# From text file
$ npm run dev -- -m=encoding -i=./temp/lena.jpg -p=./temp/message.txt
# Direct message input
$ npm run dev -- -m encoding -i=./temp/lena.jpg -d="Super Secret Message" -o=secret_lena
Basic Decoding
$ npm run dev -- -m=decoding -i=./outputs/secret_lena.png -o=extracted_message
Utility Commands
# Show help
$ npm run dev -- --help
# Check version
$ npm run dev -- --version
📷 Demonstration
$ npm run dev -- -m encoding -i=./temp/lena.jpg -d="Super Ultra Secret Message"
| Original | Encoded |
|---|
 |  |
📚 Academic Article
This project was developed for our Digital Image Processing course and includes a technical paper explaining the methodology. If you're curious about the implementation details:
📖 Read the full article (PDF, 17 pages - in Brazilian Portuguese).
📝 License
This project is MIT Licensed. See
LICENSE file for more details.
👨💻 Authors
Ríad Oliveira
Lucas Paulino