Metadata-Version: 2.4
Name: aiposematic
Version: 0.3
Summary: Aiposematic: Scramble & Recover using image key + operation string , By: Fibo Metavinci
Author-email: Fibo Metavinci <pszdw-75nat-5227i-bha5s-y7lai-pebdq-o2agp-3xho4-hd6z6-emxrd-nqe@dmail.ai>
Description-Content-Type: text/markdown
License-Expression: MIT
License-File: LICENSE
Requires-Dist: colorama>=0.4.6
Requires-Dist: contourpy>=1.3.3
Requires-Dist: cycler>=0.12.1
Requires-Dist: fonttools>=4.60.1
Requires-Dist: imageio>=2.37.2
Requires-Dist: kiwisolver>=1.4.9
Requires-Dist: lazy-loader>=0.4
Requires-Dist: matplotlib>=3.10.7
Requires-Dist: networkx>=3.5
Requires-Dist: numpy>=2.3.4
Requires-Dist: opencv-python>=4.11.0.86
Requires-Dist: packaging>=25.0
Requires-Dist: pillow>=12.0.0
Requires-Dist: pyparsing>=3.2.5
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: qrcode>=8.2
Requires-Dist: scikit-image>=0.25.2
Requires-Dist: scipy>=1.16.3
Requires-Dist: six>=1.17.0
Requires-Dist: tifffile>=2025.10.16
Project-URL: Home, https://github.com/inviti8/aiposematic

# AIPosematic: Overt Adversarial Protection for Digital Art

AIPosematic is a Python package inspired by nature's defense mechanisms, designed to help artists and creators protect their digital artwork in an overt and visually distinctive way. Unlike traditional digital watermarking or covert adversarial examples, AIPosematic applies visible, intentional transformations that signal the work is protected while simultaneously disrupting AI training processes.

## How It Works

AIPosematic employs a multi-layered approach to protect digital images:

1. **Visual Signature**
   - Applies a unique, visible pattern to the image that serves as a warning to AI systems
   - The pattern is designed to be aesthetically integrated while remaining clearly artificial
   - Functions as a "digital aposematism" - a warning signal in the digital ecosystem

2. **Cryptographic Implementation**
   - **Secure Key Generation**: Utilizes cryptographically secure 128-bit keys (2^128 possible combinations) for encryption
   - **Dual Key System**: Combines a unique image key with a 128-bit cipher key for each protected image
   - **Operation Chaining**: Applies a sequence of reversible operations (XOR, addition, subtraction, bit rotations) defined by a customizable operation string
   - **Steganographic Embedding**: The key image is embedded using a custom algorithm that preserves visual quality while ensuring recoverability
   - **Defense-in-Depth**: Implements multiple layers of protection including spatial obfuscation and pixel-level transformations

3. **Dual Protection**
   - **Human-Visible**: The protection is intentionally visible to establish clear provenance
   - **AI-Disruptive**: The transformations are designed to confuse and degrade the performance of AI models
   - **Reversible**: Original image can be recovered with the proper key and transformation sequence

## Installation

```bash
pip install aiposematic
```

## Basic Usage

```python
from aiposematic import new_aposematic_img, recover_aposematic_img

# Protect an image
result = new_aposematic_img(
    "original.png",
    op_string='-^+',  # Transformation operations
    scramble_mode='QR'  # Key generation mode
)

# The protected image and cipher key are saved
print(f"Protected image: {result['img_path']}")
print(f"Cipher key: {result['cipher_key']}")

# Recover the original image
recovered_path = recover_aposematic_img(
    result['img_path'],
    cipher_key=result['cipher_key']
)
print(f"Recovered image: {recovered_path}")
```

## Key Features

- **Multiple Scrambling Modes**:
  - `BUTTERFLY`: Creates a butterfly pattern key meant to confuse AI models
  - `QR`: Generates a pattern of QR codes meant to confuse AI models

- **Customizable Transformations**:
  - Chain multiple operations (+, -, ^, etc.) for custom protection schemes
  - Adjust intensity and visibility of protection patterns

- **High-Quality Output**:
  - Preserves image quality for human viewers
  - Maintains compatibility with standard image formats

## Use Cases

- **Digital Art Protection**: Clearly mark and protect digital artwork
- **Dataset Poisoning**: Create "do not train" markers for AI datasets
- **Provenance Tracking**: Embed recoverable ownership information
- **Ethical AI Development**: Create clear visual indicators of usage restrictions

## License

MIT License - See [LICENSE](LICENSE) for details.

## Contributing

Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) before submitting pull requests.

## Acknowledgements

Inspired by natural aposematism and the need for better digital rights management in the age of generative AI.

