1 Star 0 Fork 0

RTools/ComfyUI_LayerStyle

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
xy2percent.py 1.22 KB
Copy Edit Raw Blame History
from .imagefunc import *
class XYtoPercent:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"background_image": ("IMAGE", ), #
"layer_image": ("IMAGE",), #
"x": ("INT", {"default": 0, "min": -99999, "max": 99999, "step": 1}),
"y": ("INT", {"default": 0, "min": -99999, "max": 99999, "step": 1}),
},
"optional": {
}
}
RETURN_TYPES = ("FLOAT", "FLOAT",)
RETURN_NAMES = ("x_percent", "x_percent",)
FUNCTION = 'xy_to_percent'
CATEGORY = '😺dzNodes/LayerUtility/Data'
def xy_to_percent(self, background_image, layer_image, x, y,):
_canvas = tensor2pil(background_image).convert('RGB')
_layer = tensor2pil(layer_image).convert('RGB')
x_percent = (x + _layer.width / 2) / _canvas.width * 100.0
y_percent = (y + _layer.height / 2) / _canvas.height * 100.0
return (x_percent, y_percent,)
NODE_CLASS_MAPPINGS = {
"LayerUtility: XY to Percent": XYtoPercent
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LayerUtility: XY to Percent": "LayerUtility: XY to Percent"
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huatool/ComfyUI_LayerStyle.git
git@gitee.com:huatool/ComfyUI_LayerStyle.git
huatool
ComfyUI_LayerStyle
ComfyUI_LayerStyle
main

Search