Skip to content

Instantly share code, notes, and snippets.

@Glidias
Last active July 24, 2025 08:11
Show Gist options
  • Save Glidias/76f33d126fae7509ef8498f3e5faf67e to your computer and use it in GitHub Desktop.
Save Glidias/76f33d126fae7509ef8498f3e5faf67e to your computer and use it in GitHub Desktop.
ComfyUI set shift values by resolution of output based off shortest side
{
"last_node_id": 42,
"last_link_id": 56,
"nodes": [
{
"id": 25,
"type": "easy showAnything",
"pos": [
1054.7166748046875,
-30.893224716186523
],
"size": [
210,
76
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "anything",
"type": "*",
"shape": 7,
"link": 14
}
],
"outputs": [
{
"name": "output",
"type": "*",
"links": null
}
],
"properties": {
"Node name for S&R": "easy showAnything"
},
"widgets_values": [
"737280"
]
},
{
"id": 38,
"type": "easy showAnything",
"pos": [
1695.2855224609375,
120.39871978759766
],
"size": [
210,
75.99999237060547
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "anything",
"type": "*",
"shape": 7,
"link": 43
}
],
"outputs": [
{
"name": "output",
"type": "*",
"links": null
}
],
"properties": {
"Node name for S&R": "easy showAnything"
},
"widgets_values": [
"1.0"
]
},
{
"id": 37,
"type": "GetImageSizeAndCount",
"pos": [
1794.3677978515625,
225.23684692382812
],
"size": [
184.8000030517578,
86
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 40
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": null
},
{
"name": "width",
"label": "720 width",
"type": "INT",
"links": [
41,
44
],
"slot_index": 1
},
{
"name": "height",
"label": "1024 height",
"type": "INT",
"links": [
42,
45
],
"slot_index": 2
},
{
"name": "count",
"label": "1 count",
"type": "INT",
"links": null
}
],
"properties": {
"Node name for S&R": "GetImageSizeAndCount"
},
"widgets_values": []
},
{
"id": 30,
"type": "easy showAnything",
"pos": [
1967.40478515625,
493.31268310546875
],
"size": [
210,
76
],
"flags": {},
"order": 15,
"mode": 0,
"inputs": [
{
"name": "anything",
"type": "*",
"shape": 7,
"link": 42
}
],
"outputs": [
{
"name": "output",
"type": "*",
"links": null
}
],
"title": "result height",
"properties": {
"Node name for S&R": "easy showAnything"
},
"widgets_values": [
"1024"
]
},
{
"id": 29,
"type": "easy showAnything",
"pos": [
1973.1268310546875,
376.1903991699219
],
"size": [
210,
76
],
"flags": {},
"order": 14,
"mode": 0,
"inputs": [
{
"name": "anything",
"type": "*",
"shape": 7,
"link": 41
}
],
"outputs": [
{
"name": "output",
"type": "*",
"links": null
}
],
"title": "result width",
"properties": {
"Node name for S&R": "easy showAnything"
},
"widgets_values": [
"720"
]
},
{
"id": 39,
"type": "SimpleMath+",
"pos": [
1741.3485107421875,
622.8707275390625
],
"size": [
210,
98
],
"flags": {},
"order": 16,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"shape": 7,
"link": 44
},
{
"name": "b",
"type": "*",
"shape": 7,
"link": 45
},
{
"name": "c",
"type": "*",
"shape": 7,
"link": null
}
],
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
46
],
"slot_index": 0
},
{
"name": "FLOAT",
"type": "FLOAT",
"links": null,
"slot_index": 1
}
],
"title": "aWidth * bHeight",
"properties": {
"Node name for S&R": "SimpleMath+"
},
"widgets_values": [
"a*b"
]
},
{
"id": 40,
"type": "easy showAnything",
"pos": [
1982.580322265625,
624.0888061523438
],
"size": [
210,
76
],
"flags": {},
"order": 17,
"mode": 0,
"inputs": [
{
"name": "anything",
"type": "*",
"shape": 7,
"link": 46
}
],
"outputs": [
{
"name": "output",
"type": "*",
"links": null
}
],
"title": "result area",
"properties": {
"Node name for S&R": "easy showAnything"
},
"widgets_values": [
"737280"
]
},
{
"id": 33,
"type": "CR Math Operation",
"pos": [
1109.0169677734375,
117.17723846435547
],
"size": [
210,
131.43386840820312
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "FLOAT",
"widget": {
"name": "a"
},
"link": 30
}
],
"outputs": [
{
"name": "a",
"type": "FLOAT",
"links": [
31,
43
],
"slot_index": 0
},
{
"name": "show_help",
"type": "STRING",
"links": []
}
],
"title": "CR Math Operation",
"properties": {
"Node name for S&R": "CR Math Operation"
},
"widgets_values": [
1,
"sqrt",
7
]
},
{
"id": 36,
"type": "SimpleMath+",
"pos": [
763.6357421875,
375.4576110839844
],
"size": [
210,
98
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"shape": 7,
"link": 55
},
{
"name": "b",
"type": "*",
"shape": 7,
"link": 54
},
{
"name": "c",
"type": "*",
"shape": 7,
"link": null
}
],
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
37
],
"slot_index": 0
},
{
"name": "FLOAT",
"type": "FLOAT",
"links": null,
"slot_index": 1
}
],
"title": "aWidth * bHeight",
"properties": {
"Node name for S&R": "SimpleMath+"
},
"widgets_values": [
"a*b"
]
},
{
"id": 35,
"type": "SimpleComparison+",
"pos": [
1035.7298583984375,
331.88665771484375
],
"size": [
221.19786071777344,
78
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"link": 37
},
{
"name": "b",
"type": "*",
"link": 34
}
],
"outputs": [
{
"name": "BOOLEAN",
"type": "BOOLEAN",
"links": [
38
],
"slot_index": 0
}
],
"title": "exceeds bArea?",
"properties": {
"Node name for S&R": "SimpleComparison+"
},
"widgets_values": [
">"
]
},
{
"id": 20,
"type": "GetImageSizeAndCount",
"pos": [
364.80816650390625,
236.15390014648438
],
"size": [
277.20001220703125,
86
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 11
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
39,
48
],
"slot_index": 0
},
{
"name": "width",
"label": "720 width",
"type": "INT",
"links": [
27,
55
],
"slot_index": 1
},
{
"name": "height",
"label": "1024 height",
"type": "INT",
"links": [
28,
54,
56
],
"slot_index": 2
},
{
"name": "count",
"label": "1 count",
"type": "INT",
"links": null
}
],
"properties": {
"Node name for S&R": "GetImageSizeAndCount"
},
"widgets_values": []
},
{
"id": 41,
"type": "ImageResizeKJ",
"pos": [
1009.151123046875,
521.9601440429688
],
"size": [
315,
266
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 48
},
{
"name": "get_image_size",
"type": "IMAGE",
"shape": 7,
"link": null
},
{
"name": "width_input",
"type": "INT",
"shape": 7,
"widget": {
"name": "width_input"
},
"link": null
},
{
"name": "height_input",
"type": "INT",
"shape": 7,
"widget": {
"name": "height_input"
},
"link": null
},
{
"name": "width",
"type": "INT",
"widget": {
"name": "width"
},
"link": 51
},
{
"name": "height",
"type": "INT",
"widget": {
"name": "height"
},
"link": 50
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
49
],
"slot_index": 0
},
{
"name": "width",
"type": "INT",
"links": [],
"slot_index": 1
},
{
"name": "height",
"type": "INT",
"links": [],
"slot_index": 2
}
],
"title": "Resize Image /16 divisible",
"properties": {
"Node name for S&R": "ImageResizeKJ"
},
"widgets_values": [
0,
452,
"nearest-exact",
true,
16,
0,
0,
"disabled"
]
},
{
"id": 42,
"type": "INTConstant",
"pos": [
909.9494018554688,
596.47607421875
],
"size": [
210,
58
],
"flags": {
"collapsed": true
},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "value",
"type": "INT",
"links": [
51
],
"slot_index": 0
}
],
"title": "0",
"properties": {
"Node name for S&R": "INTConstant"
},
"widgets_values": [
0
],
"color": "#1b4669",
"bgcolor": "#29699c"
},
{
"id": 27,
"type": "SimpleMath+",
"pos": [
1342.265625,
250.40158081054688
],
"size": [
210,
98
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"shape": 7,
"link": 56
},
{
"name": "b",
"type": "*",
"shape": 7,
"link": 31
},
{
"name": "c",
"type": "*",
"shape": 7,
"link": null
}
],
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
50
],
"slot_index": 0
},
{
"name": "FLOAT",
"type": "FLOAT",
"links": null,
"slot_index": 1
}
],
"title": "aHeight * bScale",
"properties": {
"Node name for S&R": "SimpleMath+"
},
"widgets_values": [
"a*b"
]
},
{
"id": 34,
"type": "ImpactConditionalBranch",
"pos": [
1400.9144287109375,
426.8231506347656
],
"size": [
210,
74
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "tt_value",
"type": "IMAGE",
"link": 49
},
{
"name": "ff_value",
"type": "IMAGE",
"link": 39
},
{
"name": "cond",
"type": "BOOLEAN",
"widget": {
"name": "cond"
},
"link": 38
}
],
"outputs": [
{
"name": "*",
"label": "IMAGE",
"type": "IMAGE",
"links": [
40
],
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "ImpactConditionalBranch"
},
"widgets_values": [
false
]
},
{
"id": 21,
"type": "SimpleMath+",
"pos": [
876.3275756835938,
112.9938735961914
],
"size": [
210,
98
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"shape": 7,
"link": 13
},
{
"name": "b",
"type": "*",
"shape": 7,
"link": 27
},
{
"name": "c",
"type": "*",
"shape": 7,
"link": 28
}
],
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [],
"slot_index": 0
},
{
"name": "FLOAT",
"type": "FLOAT",
"links": [
30
],
"slot_index": 1
}
],
"title": "scaling factor",
"properties": {
"Node name for S&R": "SimpleMath+"
},
"widgets_values": [
"a/(b*c)"
]
},
{
"id": 19,
"type": "EmptyImage",
"pos": [
308.3850402832031,
9.454724311828613
],
"size": [
315,
130
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
11
],
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "EmptyImage"
},
"widgets_values": [
720,
1024,
1,
0
]
},
{
"id": 22,
"type": "SimpleMath+",
"pos": [
710.9852294921875,
-36.24135971069336
],
"size": [
210,
98
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "a",
"type": "*",
"shape": 7,
"link": null
},
{
"name": "b",
"type": "*",
"shape": 7,
"link": null
},
{
"name": "c",
"type": "*",
"shape": 7,
"link": null
}
],
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
13,
14,
34
],
"slot_index": 0
},
{
"name": "FLOAT",
"type": "FLOAT",
"links": null,
"slot_index": 1
}
],
"title": "sample area max",
"properties": {
"Node name for S&R": "SimpleMath+"
},
"widgets_values": [
"1152*640"
]
}
],
"links": [
[
11,
19,
0,
20,
0,
"IMAGE"
],
[
13,
22,
0,
21,
0,
"*"
],
[
14,
22,
0,
25,
0,
"*"
],
[
27,
20,
1,
21,
1,
"*"
],
[
28,
20,
2,
21,
2,
"*"
],
[
30,
21,
1,
33,
0,
"FLOAT"
],
[
31,
33,
0,
27,
1,
"*"
],
[
34,
22,
0,
35,
1,
"*"
],
[
37,
36,
0,
35,
0,
"*"
],
[
38,
35,
0,
34,
2,
"BOOLEAN"
],
[
39,
20,
0,
34,
1,
"IMAGE"
],
[
40,
34,
0,
37,
0,
"IMAGE"
],
[
41,
37,
1,
29,
0,
"*"
],
[
42,
37,
2,
30,
0,
"*"
],
[
43,
33,
0,
38,
0,
"*"
],
[
44,
37,
1,
39,
0,
"*"
],
[
45,
37,
2,
39,
1,
"*"
],
[
46,
39,
0,
40,
0,
"*"
],
[
48,
20,
0,
41,
0,
"IMAGE"
],
[
49,
41,
0,
34,
0,
"IMAGE"
],
[
50,
27,
0,
41,
5,
"INT"
],
[
51,
42,
0,
41,
4,
"INT"
],
[
54,
20,
2,
36,
1,
"*"
],
[
55,
20,
1,
36,
0,
"*"
],
[
56,
20,
2,
27,
0,
"*"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.7247295000000012,
"offset": [
-322.8823909027082,
100.79373608090191
]
},
"ue_links": [],
"VHS_MetadataImage": true,
"VHS_latentpreview": false,
"VHS_KeepIntermediate": true,
"VHS_latentpreviewrate": 0
},
"version": 0.4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment