aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts')
-rw-r--r--src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts b/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
index 8d32221bd..4847bfeed 100644
--- a/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
+++ b/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
@@ -35,7 +35,6 @@ export class ImageUtility {
if (width < height) {
// horizontal padding, x offset
const xOffset = (canvasSize - width) / 2;
- console.log(xOffset);
ctx.drawImage(img, xOffset, 0, canvas.width, canvas.height, 0, 0, canvas.width, canvas.height);
} else {
// vertical padding, y offset
@@ -156,7 +155,7 @@ export class ImageUtility {
}
};
- // The image must be loaded!
+ // The image must be loaded
static getCanvasMask = (srcCanvas: HTMLCanvasElement): HTMLCanvasElement | undefined => {
const canvas = document.createElement('canvas');
canvas.width = canvasSize;
@@ -164,7 +163,7 @@ export class ImageUtility {
const ctx = canvas.getContext('2d');
if (!ctx) return;
ctx?.clearRect(0, 0, canvasSize, canvasSize);
- ctx.fillStyle = bgColor;
+ ctx.fillStyle = '#000000';
ctx.fillRect(0, 0, canvasSize, canvasSize);
// extract and set padding data
@@ -182,7 +181,7 @@ export class ImageUtility {
return canvas;
};
- // The image must be loaded!
+ // The image must be loaded
static getCanvasImg = (img: HTMLImageElement): HTMLCanvasElement | undefined => {
const canvas = document.createElement('canvas');
canvas.width = canvasSize;
@@ -194,10 +193,9 @@ export class ImageUtility {
const width = img.width * scale;
const height = img.height * scale;
ctx?.clearRect(0, 0, canvasSize, canvasSize);
- ctx.fillStyle = bgColor;
+ ctx.fillStyle = '#000000';
ctx.fillRect(0, 0, canvasSize, canvasSize);
- // extract and set padding data
if (img.naturalHeight > img.naturalWidth) {
// horizontal padding, x offset
const xOffset = (canvasSize - width) / 2;