Protect your images from unauthorized AI training and automated scraping.
Don't like AI greasing their grubby hands over your images? Want to make it harder for bots, scrapers, or basic ML models to analyze or steal your images, while keeping them visually usable for humans? Image Protector applies controlled perturbations to make your images harder to scrape, analyze, or use for automated processing-while remaining perfectly viewable.
π― Perfect for: Artists, photographers, content creators, and anyone who wants to protect their visual work from unauthorized use.
Note: I over-engineered this weekend project into 2K lines of code. It adds noise to images. That's it. But the code quality is solid!
Windows Users:
- Download AdvancedImageProtector.exe (GUI version and command line version)
- Select GUI version to use it as an APP and Command line version if you wish to use from the terminal.
- Double-click to launch
- Select your image and click "Protect Image"
- Done! π
Command Line Users:
# Download CLI version
wget https://github.com/Codex-Crusader/image-protector/raw/main/dist/AdvancedImageProtector-CLI.exe
# Protect an image
AdvancedImageProtector-CLI.exe input.jpg -o protected.jpg# Clone and install
git clone https://github.com/Codex-Crusader/image-protector.git
cd image-protector
pip install -r requirements/requirements.txt
# Launch GUI
python image_protector.py --gui
# Or use CLI
python image_protector.py input.jpg -o protected.jpg- Ensemble - Combines multiple techniques for maximum protection
- Frequency - DCT-based frequency domain manipulation (requires SciPy)
- Gradient - FGSM-style adversarial patterns
- Texture - Texture-aware adaptive noise
- Noise - Fast, content-adaptive random noise
- Adversarial - PGD-style iterative perturbations
- β Batch processing - Protect entire folders at once
- β Adjustable strength - From subtle (0.1) to maximum (3.0+)
- β Custom method weights - Fine-tune ensemble combinations
- β Metadata signatures - Optional invisible watermarking
- β Detailed metrics - PSNR, MSE, perturbation strength tracking
- β Progress tracking - Real-time status for batch operations
- β Cross-platform - Windows, Linux, macOS
- GUI Mode - User-friendly graphical interface (no terminal required)
- CLI Mode - Perfect for automation, scripts, and batch jobs
No Python installation needed!
AdvancedImageProtector.exe - GUI version AdvancedImageProtector-CLI.exe - Command-line version
Download directly from here.
β οΈ Note: Some antivirus software may flag PyInstaller executables as potentially unwanted. This is a common false positive. You can verify the source code in this repository.
git clone https://github.com/Codex-Crusader/image-protector.git
cd image-protectorpython -m venv venv
# Activate on Linux/macOS
source venv/bin/activate
# Activate on Windows
venv\Scripts\activateMinimal installation (core features):
pip install -r requirements/requirements.txtFull installation (all features including frequency/texture methods):
pip install -r requirements/requirements.txt
pip install scipyDevelopment installation (for contributors):
pip install -r requirements/dev-requirements.txt- Python 3.8+ - Required
- NumPy - Array operations and image processing
- Pillow (PIL) - Image I/O and format handling
- SciPy - Required for
frequencyandtexturemethods (DCT transforms, convolutions) - tkinter - Required for GUI mode (usually included with Python)
Tools for contributors (see requirements/dev-requirements.txt):
black- Code formattingruff- Lintingmypy- Type checkingpytest- Testingbuild,twine- Package building and distribution
Launch the graphical interface:
python image_protector.py --guiGUI Features:
- π File browser for easy image selection
- ποΈ Visual strength slider with live preview
- π Real-time progress tracking
- π Detailed status logging
- βΈοΈ Cancellable batch operations
- π¨ Method selection with availability indicators
Protect a single image:
python image_protector.py input.jpg -o protected.jpgChoose method and strength:
# Subtle protection (barely visible)
python image_protector.py photo.jpg -o protected.jpg -m noise -s 0.5
# Strong protection (more visible)
python image_protector.py artwork.png -o protected.png -m ensemble -s 2.5Custom ensemble weights:
python image_protector.py input.jpg -o output.jpg \
-m ensemble \
--freq 0.5 \
--grad 0.3 \
--texture 0.15 \
--noise 0.05Batch process a folder:
python image_protector.py my_photos/ -o protected_photos/ -bAdd invisible metadata signature:
python image_protector.py input.jpg -o output.jpg --signatureDisable metrics JSON (faster processing):
python image_protector.py input.jpg -o output.jpg --no-metricsVerbose mode (for debugging):
python image_protector.py input.jpg -o output.jpg -v| Option | Description | Default | Example |
|---|---|---|---|
input |
Input image file or directory | - | photo.jpg |
-o, --output |
Output file or directory | - | protected.jpg |
-b, --batch |
Enable batch processing for directories | False |
-b |
-m, --method |
Protection method (see below) | ensemble |
-m gradient |
-s, --strength |
Protection strength (0.1-5.0) | 1.0 |
-s 2.5 |
--freq |
Ensemble weight for frequency method | 0.4 |
--freq 0.5 |
--grad |
Ensemble weight for gradient method | 0.3 |
--grad 0.4 |
--texture |
Ensemble weight for texture method | 0.2 |
--texture 0.1 |
--noise |
Ensemble weight for noise method | 0.1 |
--noise 0.2 |
--signature |
Add invisible metadata signature | False |
--signature |
--no-metrics |
Don't save metrics JSON file | False |
--no-metrics |
--gui |
Launch GUI mode | False |
--gui |
-v, --verbose |
Enable verbose logging | False |
-v |
| Method | Speed | Visibility | SciPy Required | Best For |
|---|---|---|---|---|
ensemble |
Slow | Low | No* | Maximum protection |
frequency |
Medium | Very Low | Yes | Subtle, JPEG-like artifacts |
gradient |
Medium | Low | No | Edge-based protection |
texture |
Medium | Low | No* | Content-aware protection |
adversarial |
Fast | Medium | No | Quick iterative noise |
noise |
Fastest | Medium | No | Rapid batch processing |
*Some features require SciPy but will gracefully degrade without it
The tool saves protected versions of your images with configurable quality settings:
- JPEG: Quality 95, no subsampling
- PNG: Compression level 6 (balanced)
- WebP: Quality 95, method 6
Each protected image gets a corresponding .json file with detailed metrics.
Metrics Explained:
- PSNR (Peak Signal-to-Noise Ratio) - Higher = less visible changes (30-40 dB is typical)
- MSE (Mean Squared Error) - Lower = less difference from original
- Perturbation Strength - Average absolute pixel difference
- Hashes - SHA256 fingerprints for verification
Batch operations create a comprehensive batch_summary.json.
Metrics Included:
- Total images processed
- Average PSNR/MSE across batch
- Method distribution
- Processing time per image
- Success/failure counts
- Load Image - Opens with Pillow, converts to RGB if needed
- Apply Protection - Uses one or more perturbation methods
- Quality Check - Calculates PSNR and other metrics
- Save Output - Writes protected image with optional metadata
For in-depth mathematical explanations, see:
- π Mathematical Details
- π Acronyms & Terms
- π Data Flow Diagrams
Uses Discrete Cosine Transform (DCT) to add noise in the frequency domain:
- Processes image in 8Γ8 blocks (like JPEG)
- Targets high-frequency components
- Nearly invisible to human eye
- Disrupts gradient-based ML analysis
Simulates FGSM (Fast Gradient Sign Method) adversarial attacks:
- Creates interference patterns using sinusoidal functions
- Edge-aware perturbations (stronger on edges)
- Confuses feature extractors
Adds Perlin-like noise adapted to image content:
- Analyzes local texture variance
- Stronger noise in textured regions
- Preserves smooth areas
Fast, adaptive random noise injection:
- Content-aware noise scaling
- Balances speed with effectiveness
Iterative PGD-style (Projected Gradient Descent) simulation:
- 7 iterations with decaying step size
- Projects perturbations to epsilon ball
- Heuristic approach (not model-specific)
Weighted combination of all methods:
- Configurable weights for each technique
- Default weights optimized for balance
- Most comprehensive protection
Approximate processing times on a modern laptop (Intel i7, 16GB RAM):
| Image Size | Method | Time | Notes |
|---|---|---|---|
| 1920Γ1080 | noise |
~0.1s | Fastest option |
| 1920Γ1080 | gradient |
~0.2s | Good balance |
| 1920Γ1080 | frequency |
~0.5s | Requires SciPy |
| 1920Γ1080 | ensemble |
~1.0s | Most thorough |
| 4K (3840Γ2160) | ensemble |
~3.5s | Scales with resolution |
| Batch (100 images) | ensemble |
~90s | Parallel processing possible |
Performance varies based on hardware, image complexity, and strength settings
- Use
noisemethod for speed-critical applications - Disable metrics (
--no-metrics) for faster batch processing - Lower strength values process slightly faster
- SSD significantly improves batch processing
This tool adds perturbations that make images harder to use for training, acting as a deterrent rather than a guarantee. It's designed to:
- β Break naive scrapers and automated tools
- β Disrupt basic ML pipelines
- β Add computational cost to dataset collection
- β NOT provide cryptographic-level protection
- β NOT guarantee defense against determined adversaries with resources
Think of it like a bike lock: it won't stop a professional thief with power tools, but it will deter opportunistic theft.
Quick Comparison:
noise- Fastest. Adds random pixel variations. Best for batch processing.gradient- Medium speed. Structured patterns that confuse edge detection. Good balance.frequency- Slower. Modifies DCT coefficients like JPEG compression. Very subtle.texture- Medium speed. Adapts noise to image content. Preserves important details.adversarial- Fast. Iterative perturbations. Heuristic approach.ensemble- Slowest. Combines all methods. Maximum protection.
When to use what:
- Social media posts β
noise(fast, good enough) - Portfolio/artwork β
ensemble(thorough protection) - Photography β
frequency(subtle, professional) - Quick protection β
gradient(balanced)
At default strength (1.0):
- Changes are barely visible to most viewers
- PSNR typically 35-40 dB (considered "excellent" quality)
- Side-by-side comparison may show minor differences
At high strength (2.5+):
- Changes become noticeable under scrutiny
- May see slight graininess or artifacts
- Still acceptable for web viewing
Pro tip: Start at 1.0, increase gradually. Use GUI to compare results visually.
Honestly? Started as a weekend experiment. Got carried away. I regret nothing (maybe a little). But it works great!
The frequency method uses Discrete Cosine Transform (DCT) - the same math behind JPEG compression. The texture method uses advanced convolution operations for local variance analysis. These require SciPy's signal processing library.
Good news: The tool gracefully degrades without SciPy. Ensemble mode will just skip frequency/texture methods if SciPy isn't installed.
Similarities:
- Both add perturbations to protect images
- Both aim to disrupt ML training
Differences:
| Feature | Image Protector | Fawkes/Nightshade |
|---|---|---|
| Approach | General-purpose perturbations | Model-specific adversarial attacks |
| Targeting | Any automated analysis | Specific model architectures |
| Speed | Fast (< 1s per image) | Slower (requires gradient computation) |
| Requirements | Just Python + NumPy | Complex ML frameworks |
| Use Case | Broad protection | Targeted ML defense |
Our philosophy: We focus on practical, accessible protection that anyone can use, rather than research-grade adversarial ML.
By default, basic metadata is preserved (EXIF orientation, color profile). If you use the --signature flag, we add our own metadata signature to the image.
However, some metadata may be lost during processing. If preserving all metadata is critical, consider using exiftool to copy metadata after protection.
Technical Limitations:
- β Not cryptographically secure - This is obfuscation, not encryption
- β Not model-specific - Doesn't target particular ML architectures
- β Reversible with effort - Determined attackers with resources can denoise
- β No gradient access - Can't compute true adversarial perturbations without target model
Practical Limitations:
- Some methods require SciPy (optional dependency)
- Very high strength values (>3.0) visibly degrade quality
- Processing time scales with image size and method complexity
- Single-threaded (batch processing could be parallelized)
What This Tool IS:
- β A deterrent against automated scraping
- β A way to add computational cost to dataset harvesting
- β A practical tool for general-purpose image protection
- β Easy to use for non-technical users
What This Tool IS NOT:
- β A guarantee against all AI training
- β A replacement for watermarking or rights management
- β A cryptographic security solution
Recommendation: Use this as one layer in a multi-layered protection strategy that includes watermarks, proper licensing, and monitoring.
Problem: Executable flagged as potentially unwanted program (PUP)
Cause: PyInstaller bundles Python interpreter, which some antivirus heuristics flag
Solutions:
- Verify file hash matches published checksums
- Review source code (fully open source)
- Build executable yourself from source
- Add exclusion in antivirus software
- Use Python source version instead
Problem: GUI becomes unresponsive during batch operations
Status: Working as intended (processing happens in background thread)
Workaround:
- Check "Status Log" for progress updates
- Progress bar shows current status
- Use CLI mode for very large batches
Problem: High-resolution images take longer with frequency method
Cause: DCT processing on large blocks is computationally intensive
Solutions:
- Use
gradientornoisemethods for speed - Reduce image size before processing
- Use batch processing overnight
- Consider GPU acceleration (future feature)
Problem: RGBA images lose transparency
Cause: Protection algorithms work in RGB space
Status: Intentional design decision
Workaround:
- Extract alpha channel before processing
- Re-apply alpha channel after protection
- Or keep transparent areas out of protection
image-protector/
βββ image_protector.py # Main application (CLI + GUI)
βββ pyproject.toml # Package metadata and build config
βββ requirements/
β βββ requirements.txt # Core user dependencies
β βββ dev-requirements.txt # Development tools
βββ docs/
β βββ math.md # Mathematical method details
β βββ acronym.md # Glossary of terms
β βββ variable_flow.md # Data flow documentation
βββ .gitignore # Git ignore patterns
βββ LICENSE # MIT License
βββ README.md # This file
Contributions are welcome! Whether it's bug fixes, new features, documentation improvements, or performance optimizations.
- Fork the repository
- Make your changes
- Open a Pull Request
But Please keep your changes small focused and consistant with the existing code style.
# Clone your fork
git clone https://github.com/YOUR_USERNAME/image-protector.git
cd image-protector
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dev dependencies
pip install -r requirements/dev-requirements.txt
# Install pre-commit hooks (optional)
pre-commit installThis project was inspired by and builds upon the pioneering work of:
- Fawkes - Facial cloaking against unauthorized recognition
- Nightshade - Prompt-specific poisoning attacks
- The broader adversarial ML research community
- Python - Core language
- NumPy - Efficient array operations
- SciPy - Signal processing and DCT transforms
- Pillow (PIL) - Image I/O and manipulation
- tkinter - Cross-platform GUI
- PyInstaller - Executable packaging
- The open-source community for continuous inspiration
- Early testers and contributors
- All the artists and creators protecting their work
This project is licensed under the MIT License - see the LICENSE file for details.
TL;DR: You can use this commercially, modify it, distribute it, and use it privately. Just include the license notice.
If you use this tool in research, publications, or commercial products, please cite:
@software{krishnapur2025imageprotector,
author = {Krishnapur, Bhargavaram},
title = {Image Protector: Practical Image Perturbation Tool},
year = {2025},
publisher = {GitHub},
url = {https://github.com/Codex-Crusader/image-protector},
version = {2.1}
}Bhargavaram Krishnapur
- π± GitHub: @Codex-Crusader
- π§ Email: your.email@example.com
Project Link: https://github.com/Codex-Crusader/image-protector
Made with β€οΈ by Bhargavaram Krishnapur
Clankers need to learn about copyright infringement. (Yes, before you ask, Ma Boy ChatGPT gave me permission to say that.)