diff --git a/ComfyTemplate.png b/ComfyTemplate.png new file mode 100644 index 0000000..864f266 Binary files /dev/null and b/ComfyTemplate.png differ diff --git a/config.default.json b/config.default.json index 7bf9be6..6fb8102 100644 --- a/config.default.json +++ b/config.default.json @@ -74,8 +74,24 @@ "size": 500 }, "y": { + "position": 0, + "offset": 10, + "size": 500 + } + } + }, + "comfy": { + "template": "./ComfyTemplate.png", + "z": 2, + "anchor": { + "x": { "position": 50, - "offset": 300 + "offset": 250, + "size": 380 + }, + "y": { + "position": 100, + "offset": 500 } } } diff --git a/index.js b/index.js index 997bd34..5e7d435 100644 --- a/index.js +++ b/index.js @@ -48,8 +48,10 @@ function render(template, img, size) { } const xScale = width / template.anchor.x.size; - const yScale = width / template.anchor.y.size; - const templateScale = Math.min(xScale || 1, yScale || 1); + const yScale = height / template.anchor.y.size; + const templateScale = Math.max(0, Math.min(10, Math.max(xScale || 0, yScale || 0))); + console.log("templateScale",templateScale) + let templateOffsetX = calculatePosition(templateScale, template.anchor.x, width); let templateOffsetY = calculatePosition(templateScale, template.anchor.y, height);