Do you want to automate image processing without Photoshop?
A script project based on the
rembg library:📦 Installation:
pip install rembg
Example code:
from rembg import remove
def remove_background(input_path: str, output_path: str) -> None:
"""Removes the background from the image and saves the result."""
with open(input_path, 'rb') as input_file:
with open(output_path, 'wb') as output_file:
image_bytes: bytes = input_file.read()
output_bytes: bytes = remove(image_bytes)
output_file.write(output_bytes)
if __name__ == "__main__":
remove_background('input.png', 'output.png')
🟢Opens the file;
🟢Removes the background;
🟢Saves the finished image.
5️⃣ GitHub/Instructions
#python #soft #code
