# Import the necessary functions
from rembg import remove
from PIL import Image
# 1. Define the input and output file names
input_path = '' # The image you want to process
output_path = 'output_shape.png' # The result with the background removed
# 2. Open the input image
try:
input_image = Image.open(input_path)
except FileNotFoundError:
print(f"Error: The file '{input_path}' was not found.")
exit()
# 3. Use the "remove" function to process the image
# This is where the AI engine does its work!
output_image = remove(input_image)
# 4. Save the result
# The output is a PNG with a transparent background
output_image.save(output_path)
print(f"Successfully removed background. Shape saved to '{output_path}'")









































