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)
Metadata
Release files for iremover 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iremover-1.0.1.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iremover-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.5 kB
Release files / iremover-1.0.1.tar.gz
| Download URL | iremover-1.0.1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49f6a31e0eef230d55264b842305eb0d77ac820e870a61bb155f7217768c42b5
|
|
BLAKE2b-256 checksum How to use checksums |
23fd13a8d862f1c0cfd47a4021bf3c406b5ca00cc249bcd42d64e9f0ac73f851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / iremover-1.0.1-py3-none-any.whl
| Download URL | iremover-1.0.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c121357806e3e8273d3646bd9ff54ed783bfee689c24a48261c09704ee58ce7d
|
|
BLAKE2b-256 checksum How to use checksums |
42bc90d12b97f5e0a0ec9fa04442b0e93235b388e44e1505737ed89322a5fdf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|