osmanvision/OsCrop
Image background remover and auto cropper for transparent and normal images. Built with rembg, OpenCV, and Pillow.
๐ผ๏ธ OsCrop
OsCrop is a simple yet powerful open-source tool for:
- ๐งผ Removing backgrounds from images (PNG, JPG, WEBP)
- โ๏ธ Automatically cropping the main object
- ๐ฏ Outputting clean 512x512 images centered on transparent backgrounds
Made for creators and developers who want fast, clean asset extraction โ perfect for Telegram stickers, digital design, AI datasets, and more.
๐ธ Use Cases
Whether you're a creator, developer, or just someone working with digital visuals โ OsCrop simplifies your workflow.
- ๐งฉ Creating Telegram, WhatsApp, or Discord stickers
- ๐๏ธ Cleaning up product images for online shops
- ๐ง Preparing consistent assets for machine learning datasets
- ๐จ Extracting and isolating emoji, clipart, avatars, or sprites
- ๐ Streamlining bulk image cleanup for digital archives or design packs
โจ Features
- ๐ Detects objects using alpha transparency or shape detection
- ๐งผ Cleans up black glow or leftover outlines
- ๐ช Automatically centers and resizes objects onto transparent 512x512 canvases
- ๐ง Skips previously processed images
- ๐ Full automation pipeline (removal + cropping)
- ๐งฐ Supports PNG, JPG, and WEBP
- ๐ Includes author license check with anti-tamper
๐ Folder Structure
OsCrop/
โโโ oscrop_full.py # Full pipeline: background removal + crop + resize
โโโ oscrop_bg_remover.py # Only removes background using rembg
โโโ oscrop_auto_alpha_crop.py # Auto-crops transparent PNGs using alpha mask
โโโ oscrop_crop_detect.py # Crops non-transparent PNG/JPG/WEBP using object detection
โโโ run_oscrop.py # Easy launcher script for non-developers
โโโ LICENSE # Os Public License v1.0
โโโ README.md # You're reading it
โโโ requirements.txt # Python dependencies
โโโ samples/ # Includes sample images for testing
๐ฆ Installation
Make sure you have Python 3.8 or higher installed.
pip install rembg opencv-python pillow numpyโ
Python 3.8 or higher recommended
โ No GPU required
๐ป Works on Windows, Mac, Linux (tested)
โ๏ธ How to Use
1. Easy Launcher (Recommended for non-devs)
python run_oscrop.pyThis will show a menu to choose:
- Full Process
- Background Only
- Crop Transparent PNGs
- Crop Non-Transparent Images
Youโll be asked to set or confirm your input_folder.
2. Full Manual Scripts
Make sure to set
input_folderin each script before running.
A. Full Pipeline
python oscrop_full.pyCreates output_no_bg/output_crops/
B. Just Remove Background
python oscrop_bg_remover.pyCreates output_no_bg/
C. Only Crop Transparent PNGs
python oscrop_auto_alpha_crop.pyCreates alpha_crops/ folder
D. Crop Non-Transparent Images
python oscrop_crop_detect.pyCreates shape_crops/ folder
๐ If
oscrop_auto_alpha_crop.pydetects no alpha channel, it will skip and suggest usingoscrop_crop_detect.py.
๐งoscrop_crop_detect.pyalso skips full-sheet crops intelligently if they cover the whole image.
๐งช Output Samples
- All cropped images are centered and padded into clean
512x512boxes - Output folders like
alpha_crops,shape_crops,output_cropsare created automatically - Files are named sequentially like
alpha_crop_1.png,detect_crop_3.png, etc
๐ Sample Images
Included in the samples/ folder:
dark_bg.pngโ Object sheet with dark backgroundwhite_bg.pngโ Object sheet with white backgroundtransparent_sheet.pngโ PNG with alpha background
You can test the tools on these to see how they behave in different scenarios.
๐ License
Os Public License v1.0
Copyright (c) 2025 Os (Osman Vision)
You are free to use, modify, and distribute the code,
BUT the author credit must remain visible.
Tampering with the license block or removing author lines
may result in broken functionality.
For commercial licensing, contact: heyosmanvision@gmail.com
๐ฌ Contact
- Instagram: @osman_vision
- Email: heyosmanvision@gmail.com
- Discord: osman_vision
๐ง Powered by OsCrop by Osman Vision
