Skip to content

BishnuMahali/Image-Optimizer

Repository files navigation

Image Optimizer ⚡

A lightweight, powerful, and portable image optimization utility for Windows. This project now offers two ways to run, depending on your needs.


💎 Choose Your Version

1. Standard Edition (PowerShell) - Best for Portability

  • No Installation Required: Works on any Windows PC.
  • Single File: Everything is contained in ImageOptimizer.ps1.
  • Easy Launch: Just double-click Image Optimizer.bat.
  • Features: Interactive arrow-key UI, auto-dependency downloading, safety backups.

2. Advanced Edition (Python) - Best for Power Users

  • Superior UI: Uses the rich library for high-fidelity terminal panels and tables.
  • Robust Engines: Better process handling and error management via Python.
  • Requirements: Requires Python 3.8+ and pip install -r requirements.txt.
  • Usage: Run python image_optimizer.py.

🚀 Common Features

  • Magick-First Strategy: Uses ImageMagick (preferred) or FFmpeg for professional-grade results.
  • Guided Onboarding: If you don't have the tools, the scripts offer to download temporary portable versions automatically.
  • Multi-Format Support: WebP, AVIF, JPG, PNG, and more.
  • Intelligent Logic:
    • Original Size Protection: Never keeps a file if the optimized version is larger.
    • EXIF Stripping: Cleans metadata to save extra space.
    • Output Modes: Save as copy, Overwrite, or Backup to .Originals.

Enabling ImageMagick / FFmpeg

To unlock the full potential of Image Optimizer, you can provide portable binaries:

  • Place magick.exe in Tools/ImageMagick/
  • Place ffmpeg.exe in Tools/FFmpeg/

Alternatively, if these tools are already installed on your system and available in your PATH, Image Optimizer will detect and use them automatically.

Usage Examples

🌟 Recommended: Run via Web (No Download Required)

Open PowerShell in your target folder and launch the script directly from the web:

irm https://raw.githubusercontent.com/BishnuMahali/Image-Optimizer/main/ImageOptimizer.ps1 | iex

Local Execution

Interactive Mode Run the downloaded script without arguments to launch the interactive UI:

.\ImageOptimizer.ps1

Non-Interactive CLI Mode

# Optimize a single image using the "Web Optimized" preset
.\ImageOptimizer.ps1 -Path "C:\Images\photo.jpg" -Preset "WebOptimized"

# Batch optimize a folder recursively, converting to WebP
.\ImageOptimizer.ps1 -Path "C:\Images" -Recursive -Format WebP -Quality 80

# Dry-run a directory to see potential space savings
.\ImageOptimizer.ps1 -Path "C:\Images" -DryRun

Troubleshooting

  • Script execution disabled: Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser to allow PowerShell scripts to run on your system.
  • Engine not detected: Ensure magick.exe or ffmpeg.exe are placed correctly in the Tools/ directories or are accessible via system PATH.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Third-Party Notices

This project supports integration with ImageMagick and FFmpeg. These are independent open-source projects with their own licenses. Please review THIRD_PARTY_NOTICES.md for full attribution and legal details.

Contributing

Contributions are welcome! Whether it's adding new presets, improving engine abstractions, or reporting bugs, please feel free to open an issue or submit a pull request.


🤝 Support & Connect

These projects are simple utility scripts built to solve everyday problems. If you find them helpful in your workflow and would like to support me, any small contribution is deeply appreciated! ❤️

Buy Me A Coffee Ko-fi Patreon PayPal

GitHub Website YouTube Instagram Facebook X (Twitter) LinkedIn

About

Portable Windows image optimization utility with PowerShell and Python editions supporting WebP, AVIF, JPG, PNG, ImageMagick, and FFmpeg.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors