From 4a44e171fdfe06cceb377e56137dacb38d53aa51 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 15 Jul 2024 19:35:38 +1000 Subject: [PATCH] fix(ui): fix layer transparency calculation --- .../frontend/web/src/common/util/arrayBuffer.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/invokeai/frontend/web/src/common/util/arrayBuffer.ts b/invokeai/frontend/web/src/common/util/arrayBuffer.ts index c3b13dac26..f7ac9db03f 100644 --- a/invokeai/frontend/web/src/common/util/arrayBuffer.ts +++ b/invokeai/frontend/web/src/common/util/arrayBuffer.ts @@ -3,7 +3,7 @@ export const getImageDataTransparency = (imageData: ImageData) => { let isPartiallyTransparent = false; const len = imageData.data.length; for (let i = 3; i < len; i += 4) { - if (imageData.data[i] === 255) { + if (imageData.data[i] !== 0) { isFullyTransparent = false; } else { isPartiallyTransparent = true; @@ -14,14 +14,3 @@ export const getImageDataTransparency = (imageData: ImageData) => { } return { isFullyTransparent, isPartiallyTransparent }; }; - -export const areAnyPixelsBlack = (pixels: Uint8ClampedArray) => { - const len = pixels.length; - const i = 0; - for (let i = 0; i < len; i) { - if (pixels[i++] === 0 && pixels[i++] === 0 && pixels[i++] === 0 && pixels[i++] === 255) { - return true; - } - } - return false; -};