-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Description
Sorry for the "guide" type question, but having a hard time finding the right docs here. I have an original image, and using SAM2 I created a mask of the image with the pixels I am interested in keeping.
In python here's what I did with the Image library, and it works, results in the image I'm looking for.
from PIL import Image
# Load the original image and the mask
original = Image.open("original.png")
mask = Image.open("mask.png").convert("L") # Convert mask to grayscale
# Ensure both images are the same size
if original.size != mask.size:
raise ValueError("Original and mask images must have the same dimensions")
# Create a new transparent image and paste the original using the mask
result = Image.new("RGBA", original.size)
result.paste(original, (0, 0), mask)
# Save the result
result.save("result.png")
How can I do similar with the Image library in Elixir?
Metadata
Metadata
Assignees
Labels
No labels