-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRandomSizeNode.py
More file actions
34 lines (23 loc) · 907 Bytes
/
RandomSizeNode.py
File metadata and controls
34 lines (23 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
class RandomSizeNode:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"min_width": ("INT", {"default": 512}),
"max_width": ("INT", {"default": 1024}),
"min_height": ("INT", {"default": 512}),
"max_height": ("INT", {"default": 1024}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
},
}
FUNCTION = "random_value"
def random_value(self, min_width, max_width,min_height,max_height, seed):
np.random.seed(seed)
width = np.random.randint(min_width, max_width)
height = np.random.randint(min_height, max_height)
return (width, height,)
RETURN_TYPES = ("INT", "INT")
RETURN_NAMES = ("width", "height")
OUTPUT_NODE = True
CATEGORY = "ecjojo_example"