This is complete Python package module implementing: 1 - Background removal, 2 - Add background color/template. 3 - Enhance image quality, 4 - Resize and compress image, 5 - Resize by custom height*width
⭐ Background Removal • Smart Background Add • AI-Ready Enhancement • Compression • Resize • Quality Boost
Image Magic Suite is a powerful, production-ready Python package designed for modern image processing needs. It provides all essential features in a single, lightweight module:
This package is ideal for:
- E-commerce product photo optimization
- ID photo editing
- Social media content apps
- SaaS products
- Bulk image processing pipelines
- Automation workflows
- AI datasets preprocessing
Uses the popular rembg AI engine to remove backgrounds cleanly and produce transparent PNG output.
Apply plain colors or a custom background template (overlay).
Improve sharpness, brightness & contrast using Pillow’s enhancement tools.
Automatically reduce file size (KB range) while trying to preserve visual quality.
Resize with LANCZOS (best image quality for downscaling).
pip install pillow rembg numpyfrom image_tools import ImageProcessor
processor = ImageProcessor()
processor.remove_bg("input.jpg", "output.png")
processor.add_background("input.png", "bg_added.jpg", bg_color=(255,255,255))
processor.enhance_quality("input.jpg", "enhanced.jpg")
processor.compress_to_size("input.jpg", "compressed.jpg", target_kb=80)
processor.resize_dimensions("input.jpg", "resized.jpg", width=800, height=600)This module contains complete implementations for:
Reads image → passes to rembg → writes transparent PNG.
Add solid color or template overlay (RGBA alpha composite).
Boosts sharpness, brightness, contrast with Pillow.
Iteratively reduces quality until reaching target size in KB.
Uses high-quality LANCZOS filter to preserve clarity.
All functions have error handling, clean code, PEP8 compliant, and clear docstrings.

.png)
.png)