first commit

This commit is contained in:
jstit
2024-08-13 16:19:15 +07:00
commit b618225d5d
3 changed files with 49 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
from .nodes import (
image_crop_circle,
)
NODE_CLASS_MAPPINGS = {
**image_crop_circle.NODE_CLASS_MAPPINGS,
}
+39
View File
@@ -0,0 +1,39 @@
import numpy as np
from PIL import Image, ImageDraw
class ImageCropCircle:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"image": ("IMAGE",),
}
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "crop_circle"
CATEGORY = "image/crop"
def crop_circle(self, image):
size = min(image.size)
mask = Image.new("L", (size, size), 0)
draw = ImageDraw.Draw(mask)
draw.ellipse((0, 0, size, size), fill=255)
result = Image.new("RGBA", (size, size))
result.paste(image, (0, 0), mask)
return (result,)
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"ImageCropCircle": ImageCropCircle,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"ImageCropCircle": "ImageCropCircle",
}
+3
View File
@@ -0,0 +1,3 @@
diffusers
tqdm
boto3