Merge pull request #52 from cubiq/main

ImageBatchFromValueSchedule now works with any range of values
This commit is contained in:
FizzleDorf
2023-12-19 14:21:39 -05:00
committed by GitHub
+4 -4
View File
@@ -625,7 +625,6 @@ class BatchValueScheduleLatentInput:
return (t, list(map(int,t)), num_latents, )
# Expects a Batch Value Schedule list input, it exports an image batch with images taken from an input image batch
# Expects values to be in range -1...1, could be normalized to accept any value range
class ImageBatchFromValueSchedule:
@classmethod
def INPUT_TYPES(s):
@@ -641,6 +640,7 @@ class ImageBatchFromValueSchedule:
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
def animate(self, images, values):
n = images.shape[0] - 1
values = [values] * n if isinstance(values, float) else [round((v + 1) / 2 * n) for v in values]
return (images[values], )
values = [values] * n if isinstance(values, float) else values
min_value, max_value = min(values), max(values)
i = [(x - min_value) / (max_value - min_value) * (images.shape[0] - 1) for x in values]
return (images[i], )