Created
June 4, 2023 17:14
-
-
Save HaroldPetersInskipp/8816d70e237205e1d30c2a740a06e031 to your computer and use it in GitHub Desktop.
Image generation and manipulation in Node-RED
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "b20e5b5f063ba375", | |
"type": "tab", | |
"label": "SpriteGen", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "f7032ae1fd6d8243", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "spaceship", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random spaceship created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.spaceship);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 240, | |
"y": 120, | |
"wires": [ | |
[ | |
"6ec23a228495d8a5", | |
"01a44382308a8f6a" | |
] | |
] | |
}, | |
{ | |
"id": "0bad573ae4521a62", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 120, | |
"wires": [ | |
[ | |
"f7032ae1fd6d8243" | |
] | |
] | |
}, | |
{ | |
"id": "6ec23a228495d8a5", | |
"type": "debug", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 430, | |
"y": 200, | |
"wires": [] | |
}, | |
{ | |
"id": "0eefaa6344c71eb9", | |
"type": "file in", | |
"z": "b20e5b5f063ba375", | |
"name": "get file", | |
"filename": "filename", | |
"filenameType": "msg", | |
"format": "", | |
"chunk": false, | |
"sendError": false, | |
"encoding": "none", | |
"allProps": false, | |
"x": 610, | |
"y": 160, | |
"wires": [ | |
[ | |
"f0e088278d29ee37" | |
] | |
] | |
}, | |
{ | |
"id": "01a44382308a8f6a", | |
"type": "delay", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"pauseType": "delay", | |
"timeout": "200", | |
"timeoutUnits": "milliseconds", | |
"rate": "1", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": false, | |
"allowrate": false, | |
"outputs": 1, | |
"x": 450, | |
"y": 120, | |
"wires": [ | |
[ | |
"0eefaa6344c71eb9", | |
"6d30af73f4d723a5" | |
] | |
] | |
}, | |
{ | |
"id": "f0e088278d29ee37", | |
"type": "file", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"filename": "/home/pi/temp/tempfile.png", | |
"filenameType": "str", | |
"appendNewline": false, | |
"createDir": true, | |
"overwriteFile": "true", | |
"encoding": "none", | |
"x": 820, | |
"y": 160, | |
"wires": [ | |
[ | |
"426fae590baa1268" | |
] | |
] | |
}, | |
{ | |
"id": "d21a234fcb31b717", | |
"type": "file", | |
"z": "b20e5b5f063ba375", | |
"name": "delete file", | |
"filename": "filename", | |
"filenameType": "msg", | |
"appendNewline": true, | |
"createDir": false, | |
"overwriteFile": "delete", | |
"encoding": "none", | |
"x": 760, | |
"y": 80, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "6d30af73f4d723a5", | |
"type": "delay", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"pauseType": "delay", | |
"timeout": "5", | |
"timeoutUnits": "seconds", | |
"rate": "1", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": false, | |
"allowrate": false, | |
"outputs": 1, | |
"x": 620, | |
"y": 80, | |
"wires": [ | |
[ | |
"d21a234fcb31b717" | |
] | |
] | |
}, | |
{ | |
"id": "ebb5935d06bd9619", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "dragon", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random dragon created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.dragon);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 240, | |
"y": 80, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "bd81e6c105db6710", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "bug", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random bug created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.bug);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 230, | |
"y": 40, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "9664f58e03d488e0", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 80, | |
"wires": [ | |
[ | |
"ebb5935d06bd9619" | |
] | |
] | |
}, | |
{ | |
"id": "372c5b5c9ae91cdf", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 40, | |
"wires": [ | |
[ | |
"bd81e6c105db6710" | |
] | |
] | |
}, | |
{ | |
"id": "e54563b3fd696174", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "creature", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random creature created\", \"filename\": outputDirectory + name + \".png\" });\n});", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 240, | |
"y": 160, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "97c828c95bc93331", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "humaniod", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random humaniod created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.humaniod);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 240, | |
"y": 200, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "96d0cc9ebf1b4f30", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "tops", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random top created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.bathingsuittops);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 230, | |
"y": 240, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "b67726b2fe2b4835", | |
"type": "function", | |
"z": "b20e5b5f063ba375", | |
"name": "bottoms", | |
"func": "const outputDirectory = \"/home/pi/temp/\";\nconst x = pixelMaker.createCreature(outputDirectory, (name) => {\n node.send({ \"payload\": \"Random bottoms created\", \"filename\": outputDirectory + name + \".png\" });\n}, pixelMaker.masks.bathingsuitbottoms);", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "pixelMaker", | |
"module": "pixel-sprite-generator-nodejs" | |
} | |
], | |
"x": 240, | |
"y": 280, | |
"wires": [ | |
[ | |
"01a44382308a8f6a", | |
"6ec23a228495d8a5" | |
] | |
] | |
}, | |
{ | |
"id": "45ae977d7f8c43ed", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 160, | |
"wires": [ | |
[ | |
"e54563b3fd696174" | |
] | |
] | |
}, | |
{ | |
"id": "d34d481d6b133953", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 200, | |
"wires": [ | |
[ | |
"97c828c95bc93331" | |
] | |
] | |
}, | |
{ | |
"id": "07709031b4784346", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 240, | |
"wires": [ | |
[ | |
"96d0cc9ebf1b4f30" | |
] | |
] | |
}, | |
{ | |
"id": "1036a79ab6198bf2", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 280, | |
"wires": [ | |
[ | |
"b67726b2fe2b4835" | |
] | |
] | |
}, | |
{ | |
"id": "426fae590baa1268", | |
"type": "image viewer", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"width": "64", | |
"data": "payload", | |
"dataType": "msg", | |
"active": true, | |
"x": 1050, | |
"y": 160, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "cc77c7cf5c62e0a7", | |
"type": "file in", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"filename": "/home/pi/temp/tempfile.png", | |
"filenameType": "str", | |
"format": "", | |
"chunk": false, | |
"sendError": false, | |
"encoding": "none", | |
"allProps": false, | |
"x": 700, | |
"y": 400, | |
"wires": [ | |
[ | |
"7bcc16ef9822aae6" | |
] | |
] | |
}, | |
{ | |
"id": "7852761d0cd69433", | |
"type": "inject", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 510, | |
"y": 400, | |
"wires": [ | |
[ | |
"cc77c7cf5c62e0a7" | |
] | |
] | |
}, | |
{ | |
"id": "7bcc16ef9822aae6", | |
"type": "jimp-image", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"data": "payload", | |
"dataType": "msg", | |
"ret": "img", | |
"parameter1": "false", | |
"parameter1Type": "bool", | |
"parameter2": "true", | |
"parameter2Type": "bool", | |
"parameter3": "", | |
"parameter3Type": "msg", | |
"parameter4": "", | |
"parameter4Type": "msg", | |
"parameter5": "", | |
"parameter5Type": "msg", | |
"parameter6": "", | |
"parameter6Type": "msg", | |
"parameter7": "", | |
"parameter7Type": "msg", | |
"parameter8": "", | |
"parameter8Type": "msg", | |
"sendProperty": "payload", | |
"sendPropertyType": "msg", | |
"parameterCount": 2, | |
"jimpFunction": "flip", | |
"selectedJimpFunction": { | |
"name": "flip", | |
"fn": "flip", | |
"description": "flip the image horizontally or vertically", | |
"parameters": [ | |
{ | |
"name": "horz", | |
"type": "bool", | |
"required": true, | |
"hint": "if true the image will be flipped horizontally" | |
}, | |
{ | |
"name": "vert", | |
"type": "bool", | |
"required": true, | |
"hint": "if true the image will be flipped vertically" | |
} | |
] | |
}, | |
"x": 910, | |
"y": 400, | |
"wires": [ | |
[ | |
"53df24ace21d3274" | |
] | |
] | |
}, | |
{ | |
"id": "53df24ace21d3274", | |
"type": "image viewer", | |
"z": "b20e5b5f063ba375", | |
"name": "", | |
"width": 160, | |
"data": "payload", | |
"dataType": "msg", | |
"active": true, | |
"x": 1050, | |
"y": 400, | |
"wires": [ | |
[] | |
] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment