Fix SimpleLoadImageWithMetadata

This commit is contained in:
KLL535
2025-03-10 00:53:41 +03:00
parent d6b64aafb3
commit 19a75b10ee
3 changed files with 17 additions and 27 deletions
+1
View File
@@ -1,4 +1,5 @@
# nightly
- Fix `SimpleLoadImageWithMetadata`
- Add `Simple Remove Think` node
# v1.0.6
- Add `Simple Auto Bypass` node
+13 -6
View File
@@ -1,9 +1,16 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "Simple Load Image With Metadata",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "Simple Load Image With Metadata") {
nodeData.input.required.upload = ["IMAGEUPLOAD"];
}
},
name: "Simple Load Image With Metadata",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "Simple Load Image With Metadata") {
nodeData.INPUT_TYPES = {
upload: {
type: "IMAGEUPLOAD",
required: true,
default: null
}
};
}
},
});
+3 -21
View File
@@ -685,14 +685,9 @@ class SimpleImageSaver:
################################
class SimpleLoadImageWithMetadataString:
@classmethod
def INPUT_TYPES(s):
input_dir = folder_paths.get_input_directory()
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
return {"required":
{"image": (sorted(files), )},
}
from nodes import LoadImage
class SimpleLoadImageWithMetadataString(LoadImage):
CATEGORY = "📚 SimpleButcher"
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "STRING", "STRING")
RETURN_NAMES = ("image", "mask", "metadata_parameters (forge)", "metadata_workflow", "metadata_prompt")
@@ -730,19 +725,6 @@ class SimpleLoadImageWithMetadataString:
return (image, mask, forge, workflow_json, prompt_json)
@classmethod
def IS_CHANGED(s, image):
image_path = folder_paths.get_annotated_filepath(image)
m = hashlib.sha256()
with open(image_path, 'rb') as f:
m.update(f.read())
return m.digest().hex()
@classmethod
def VALIDATE_INPUTS(s, image):
if not folder_paths.exists_annotated_filepath(image):
return "Invalid image file: {}".format(image)
return True
class SimpleLoadImagesFromDir: