Python 3 library. Image background remover.
Project description
iremover

Image background remover
Requirements
python: >3.7
Installation
pip install iremover
Usage as a cli
After installation, iiremover can be used simply by typing iremover in the terminal window.
The iremover command has 3 subcommands, one for each input type:
ifor filesiremover i path/to/input.png path/to/output.png
pfor foldersiremover p path/to/input path/to/output
sfor http servercurl -s "http://localhost:5000/?url=http://input.png" -o output.png
A reference about the main team can be obtained by using:
iremover --help
And also about all the subcommands used:
iremover <COMMAND> --help
Usage as a library
Input and output as bytes
from iremover import remove
input_path = 'input.png'
output_path = 'output.png'
with open(input_path, 'rb') as i:
with open(output_path, 'wb') as o:
input = i.read()
output = remove(input)
o.write(output)
Input and output as a PIL image
from iremover import remove
from PIL import Image
input_path = 'input.png'
output_path = 'output.png'
input = Image.open(input_path)
output = remove(input)
output.save(output_path)
Input and output as a numpy array
from iremover import remove
import cv2
input_path = 'input.png'
output_path = 'output.png'
input = cv2.imread(input_path)
output = remove(input)
cv2.imwrite(output_path, output)
How to iterate over files in a performatic way
from pathlib import Path
from iremover import remove, new_session
session = new_session()
for file in Path('path/to/folder').glob('*.png'):
input_path = str(file)
output_path = str(file.parent / (file.stem + ".out.png"))
with open(input_path, 'rb') as i:
with open(output_path, 'wb') as o:
input = i.read()
output = remove(input, session=session)
o.write(output)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iremover-1.0.1.tar.gz.
File metadata
- Download URL: iremover-1.0.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49f6a31e0eef230d55264b842305eb0d77ac820e870a61bb155f7217768c42b5
|
|
| MD5 |
2d01dc982f023026ec487dca70a898d0
|
|
| BLAKE2b-256 |
23fd13a8d862f1c0cfd47a4021bf3c406b5ca00cc249bcd42d64e9f0ac73f851
|
File details
Details for the file iremover-1.0.1-py3-none-any.whl.
File metadata
- Download URL: iremover-1.0.1-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c121357806e3e8273d3646bd9ff54ed783bfee689c24a48261c09704ee58ce7d
|
|
| MD5 |
34f64eb6c68de4cdaa1fb43454a8ddd8
|
|
| BLAKE2b-256 |
42bc90d12b97f5e0a0ec9fa04442b0e93235b388e44e1505737ed89322a5fdf0
|