Skip to content
Snippets Groups Projects
Commit 08aca00a authored by ThePurpleOne's avatar ThePurpleOne
Browse files

Added image resizing in flow

parent 026e3ee2
No related branches found
No related tags found
1 merge request!3added server into master
FROM nodered/node-red
USER root
RUN apk add --no-cache imagemagick && \
chmod -R 777 /data
USER node-red
\ No newline at end of file
......@@ -13,12 +13,13 @@ services:
- ./mosquitto/log:/mosquitto/log
nodered:
image: nodered/node-red
build:
context: .
dockerfile: Dockerfile.nodered
restart: always
ports:
- 1880:1880
volumes:
- ./nodered/data:/data
depends_on:
- mosquitto
command: bash -c "npm install --save red-contrib-image-tools && npm start"
\ No newline at end of file
- mosquitto
\ No newline at end of file
src/server/nodered/data/current_image.png

887 B

File added
......@@ -7,11 +7,152 @@
"info": "",
"env": []
},
{
"id": "ab311349d4b5cc9f",
"type": "group",
"z": "3bceb6b167ec8f8a",
"name": "Send specified text to specified topic",
"style": {
"fill": "#d1d1d1",
"label": true,
"stroke": "#0070c0",
"fill-opacity": "0.39",
"label-position": "n",
"color": "#000000"
},
"nodes": [
"6733248e98f29d82",
"36f36de07403b7d6",
"20bcaabc7490baa3",
"0bdc49908bd4f2f1",
"87c4ad3199d925b7",
"42dbb76d083c3f72",
"93da9eba0950dd63",
"72c71253f8eba10b",
"265bcfa660b95831"
],
"x": 274,
"y": 819,
"w": 1112,
"h": 182
},
{
"id": "cef277eaea93cf97",
"type": "group",
"z": "3bceb6b167ec8f8a",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"a63837b2eb699492",
"e20cd041191b8d4e",
"78ab95610abae69c",
"4e424320f91a0972",
"d4274a7556fc52fd",
"ac11c7560fd51964",
"450b91f9f9995ab9",
"cc59fd7b9c9b3506",
"c8a3cea728dcb733",
"4ca6c5aab2ed689f",
"215e9359f56544ac",
"832dd4609eeee57d",
"f47dec60f15aec1e"
],
"x": 274,
"y": 39,
"w": 1572,
"h": 242
},
{
"id": "33e927adfa7339c6",
"type": "group",
"z": "3bceb6b167ec8f8a",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"b826d57ee3a29903",
"0559e96b14f3b3aa",
"87fd07530005b8d7",
"1b58c8a5d3013bb3",
"4cd2b8e22daa26d1",
"2aafe2f8036cf29d",
"9b320aa0f05f6f60",
"691a5ba5df37551b",
"7827e7131abb42bd",
"ef46247ac204a721",
"706ccfd82d795270",
"fa69925fce69b14f",
"5a542a293c03214f"
],
"x": 274,
"y": 319,
"w": 1572,
"h": 242
},
{
"id": "b37cc1f0a54b395f",
"type": "group",
"z": "3bceb6b167ec8f8a",
"name": "Image choice",
"style": {
"label": true,
"label-position": "n",
"color": "#000000"
},
"nodes": [
"c5268070.c55a3",
"5e18b80e617a3db8",
"c084ef02cb008e01",
"961a4eb72567178d"
],
"x": 1134,
"y": 579,
"w": 592,
"h": 162
},
{
"id": "3f31d3a22e2ed424",
"type": "group",
"z": "3bceb6b167ec8f8a",
"name": "Cluster size management",
"style": {
"label": true,
"label-position": "n",
"color": "#000000"
},
"nodes": [
"9a776038fabcbc12",
"913bc42e687c40dc",
"f091b9306cf9ecbd",
"bd55fb4e5bd7ca09",
"ee884f98c1da8270",
"356add1a97a5f06a",
"ca8c09f033269fd4",
"f391acb6082be40f"
],
"x": 274,
"y": 579,
"w": 832,
"h": 202
},
{
"id": "7c97b0098dfaf791",
"type": "mqtt-broker",
"name": "Laptop broker",
"broker": "192.168.1.103",
"broker": "192.168.1.101",
"port": "1883",
"clientid": "",
"autoConnect": true,
......@@ -37,7 +178,7 @@
{
"id": "d2a2041e4b1000cb",
"type": "ui_tab",
"name": "Image",
"name": "MQTT Dashboard",
"icon": "dashboard",
"disabled": false,
"hidden": false
......@@ -46,19 +187,20 @@
"id": "fec55bf4e58f79e6",
"type": "ui_base",
"theme": {
"name": "theme-light",
"name": "theme-dark",
"lightTheme": {
"default": "#0094CE",
"baseColor": "#0094CE",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"baseColor": "#ed333b",
"baseFont": "Impact,Impact,Charcoal,sans-serif",
"edited": true,
"reset": false
},
"darkTheme": {
"default": "#097479",
"baseColor": "#097479",
"baseColor": "#99c1f1",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"edited": false
"edited": true,
"reset": false
},
"customTheme": {
"name": "Untitled Theme 1",
......@@ -68,16 +210,16 @@
},
"themeState": {
"base-color": {
"default": "#0094CE",
"value": "#0094CE",
"edited": false
"default": "#097479",
"value": "#99c1f1",
"edited": true
},
"page-titlebar-backgroundColor": {
"value": "#0094CE",
"value": "#99c1f1",
"edited": false
},
"page-backgroundColor": {
"value": "#fafafa",
"value": "#111111",
"edited": false
},
"page-sidebar-backgroundColor": {
......@@ -85,27 +227,27 @@
"edited": false
},
"group-textColor": {
"value": "#1bbfff",
"value": "#dceafa",
"edited": false
},
"group-borderColor": {
"value": "#ffffff",
"value": "#555555",
"edited": false
},
"group-backgroundColor": {
"value": "#ffffff",
"value": "#333333",
"edited": false
},
"widget-textColor": {
"value": "#111111",
"value": "#eeeeee",
"edited": false
},
"widget-backgroundColor": {
"value": "#0094ce",
"value": "#99c1f1",
"edited": false
},
"widget-borderColor": {
"value": "#ffffff",
"value": "#333333",
"edited": false
},
"base-font": {
......@@ -142,37 +284,30 @@
{
"id": "e342ae49e88427ae",
"type": "ui_group",
"name": "Default",
"name": "Image",
"tab": "d2a2041e4b1000cb",
"order": 1,
"order": 2,
"disp": true,
"width": "6",
"width": "10",
"collapse": false
},
{
"id": "c33a1024a72aa169",
"type": "ui_group",
"name": "Text",
"tab": "cc6c4310cf7b61cc",
"tab": "d2a2041e4b1000cb",
"order": 1,
"disp": true,
"width": "10",
"collapse": false
},
{
"id": "cc6c4310cf7b61cc",
"type": "ui_tab",
"name": "Text",
"icon": "dashboard",
"disabled": false,
"hidden": false
},
{
"id": "6733248e98f29d82",
"type": "mqtt out",
"z": "3bceb6b167ec8f8a",
"name": "",
"topic": "tophone",
"g": "ab311349d4b5cc9f",
"name": "To specified topic",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
......@@ -181,16 +316,17 @@
"correl": "",
"expiry": "",
"broker": "7c97b0098dfaf791",
"x": 1140,
"y": 460,
"x": 1270,
"y": 960,
"wires": []
},
{
"id": "9a776038fabcbc12",
"type": "mqtt in",
"z": "3bceb6b167ec8f8a",
"name": "",
"topic": "topc",
"g": "3f31d3a22e2ed424",
"name": "from cluster2/size",
"topic": "cluster2/size",
"qos": "2",
"datatype": "auto-detect",
"broker": "7c97b0098dfaf791",
......@@ -198,11 +334,12 @@
"rap": true,
"rh": 0,
"inputs": 0,
"x": 590,
"x": 380,
"y": 740,
"wires": [
[
"913bc42e687c40dc"
"ee884f98c1da8270",
"ca8c09f033269fd4"
]
]
},
......@@ -210,16 +347,17 @@
"id": "913bc42e687c40dc",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"name": "debug 2",
"g": "3f31d3a22e2ed424",
"name": "Size cluster 2",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 790,
"x": 980,
"y": 740,
"wires": []
},
......@@ -227,8 +365,9 @@
"id": "f091b9306cf9ecbd",
"type": "mqtt in",
"z": "3bceb6b167ec8f8a",
"name": "",
"topic": "fromesp",
"g": "3f31d3a22e2ed424",
"name": "from cluster1/size",
"topic": "cluster1/size",
"qos": "2",
"datatype": "auto-detect",
"broker": "7c97b0098dfaf791",
......@@ -236,11 +375,12 @@
"rap": true,
"rh": 0,
"inputs": 0,
"x": 580,
"y": 800,
"x": 380,
"y": 660,
"wires": [
[
"bd55fb4e5bd7ca09"
"356add1a97a5f06a",
"f391acb6082be40f"
]
]
},
......@@ -248,25 +388,27 @@
"id": "bd55fb4e5bd7ca09",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"name": "debug 3",
"g": "3f31d3a22e2ed424",
"name": "Size cluster 1",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 790,
"y": 800,
"x": 980,
"y": 660,
"wires": []
},
{
"id": "a63837b2eb699492",
"type": "mqtt out",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "",
"topic": "toesp/image",
"topic": "cluster1/image",
"qos": "",
"retain": "",
"respTopic": "",
......@@ -275,45 +417,29 @@
"correl": "",
"expiry": "",
"broker": "7c97b0098dfaf791",
"x": 1310,
"y": 240,
"wires": []
},
{
"id": "db996401e5e29e5c",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"name": "debug 6",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 220,
"x": 1740,
"y": 180,
"wires": []
},
{
"id": "e20cd041191b8d4e",
"type": "file in",
"z": "3bceb6b167ec8f8a",
"name": "read",
"filename": "/data/pika.ppm",
"filenameType": "str",
"g": "cef277eaea93cf97",
"name": "read image",
"filename": "path",
"filenameType": "msg",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 690,
"y": 240,
"x": 1550,
"y": 180,
"wires": [
[
"db996401e5e29e5c",
"a63837b2eb699492"
"a63837b2eb699492",
"f47dec60f15aec1e"
]
]
},
......@@ -321,26 +447,27 @@
"id": "78ab95610abae69c",
"type": "ui_button",
"z": "3bceb6b167ec8f8a",
"name": "",
"g": "cef277eaea93cf97",
"name": "Send image cluster 1",
"group": "e342ae49e88427ae",
"order": 0,
"width": "3",
"height": "2",
"order": 1,
"width": 10,
"height": 1,
"passthru": false,
"label": "button",
"label": "Send image to cluster 1",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "/data/med.ppm",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 530,
"y": 240,
"x": 400,
"y": 80,
"wires": [
[
"e20cd041191b8d4e"
"cc59fd7b9c9b3506"
]
]
},
......@@ -348,21 +475,24 @@
"id": "c5268070.c55a3",
"type": "ui_template",
"z": "3bceb6b167ec8f8a",
"g": "b37cc1f0a54b395f",
"group": "e342ae49e88427ae",
"name": "Upload Btn",
"order": 8,
"width": "3",
"height": 1,
"format": "\n<body>\n<button class=\"md-raised md-button md-ink-ripple\" onclick=\"importData()\">Upload</button> \n\n<script>\nlet restoreScope = scope;\n\nfunction importData() {\n let input = document.createElement('input');\n input.type = 'file';\n input.id = 'restoreBtn';\n input.onchange = _ => {\n // you can use this method to get file and perform respective operations\n let fReader = new FileReader();\n fReader.readAsText(input.files[0]);\n fReader.onloadend = function(event){\n restoreScope.send({payload:event.target.result});}\n };\n input.click();\n}\n</script>\n</body>\n",
"order": 2,
"width": "10",
"height": "1",
"format": "\n<body>\n<button class=\"md-raised md-button md-ink-ripple\" onclick=\"importData()\">Upload</button> \n\n<script>\nlet restoreScope = scope;\n\nfunction importData() {\n let input = document.createElement('input');\n input.type = 'file';\n input.id = 'restoreBtn';\n input.onchange = _ => {\n let file = input.files[0];\n\n // you can use this method to get file and perform respective operations\n let fReader = new FileReader();\n fReader.readAsText(input.files[0]);\n fReader.onloadend = function(event)\n {\n let filename = file.name;\n let payload = event.target.result;\n restoreScope.send({payload: payload, filename: filename});}\n };\n input.click();\n}\n</script>\n</body>\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": false,
"templateScope": "local",
"x": 550,
"y": 280,
"x": 1230,
"y": 660,
"wires": [
[
"5e18b80e617a3db8"
"5e18b80e617a3db8",
"c084ef02cb008e01",
"961a4eb72567178d"
]
]
},
......@@ -370,68 +500,597 @@
"id": "5e18b80e617a3db8",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"name": "",
"active": false,
"g": "b37cc1f0a54b395f",
"name": "Uploaded Image filename",
"active": true,
"tosidebar": true,
"console": false,
"console": true,
"tostatus": false,
"complete": "false",
"complete": "filename",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 280,
"x": 1480,
"y": 700,
"wires": []
},
{
"id": "36f36de07403b7d6",
"type": "ui_text_input",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "Message",
"label": "Message",
"tooltip": "",
"group": "c33a1024a72aa169",
"order": 1,
"width": "6",
"height": "3",
"width": 10,
"height": 3,
"passthru": true,
"mode": "text",
"delay": "0",
"topic": "payload",
"topicType": "msg",
"x": 360,
"y": 900,
"wires": [
[
"87c4ad3199d925b7"
]
]
},
{
"id": "20bcaabc7490baa3",
"type": "ui_button",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "",
"group": "c33a1024a72aa169",
"order": 2,
"width": 10,
"height": 1,
"passthru": false,
"label": "Send ",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "message",
"payloadType": "flow",
"topic": "",
"topicType": "str",
"x": 370,
"y": 940,
"wires": [
[
"42dbb76d083c3f72"
]
]
},
{
"id": "0bdc49908bd4f2f1",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "debug 7",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1240,
"y": 920,
"wires": []
},
{
"id": "87c4ad3199d925b7",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "save msg.payload into flow.message",
"rules": [
{
"t": "set",
"p": "message",
"pt": "flow",
"to": "payload",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 900,
"wires": [
[]
]
},
{
"id": "42dbb76d083c3f72",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "save flow.message into msg.payload",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "message",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 940,
"wires": [
[
"265bcfa660b95831"
]
]
},
{
"id": "93da9eba0950dd63",
"type": "ui_text_input",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "Topic",
"label": "Topic",
"tooltip": "",
"group": "c33a1024a72aa169",
"order": 1,
"width": 10,
"height": 3,
"passthru": true,
"mode": "text",
"delay": "0",
"topic": "none",
"topicType": "flow",
"x": 700,
"y": 440,
"topic": "",
"topicType": "str",
"x": 370,
"y": 860,
"wires": [
[
"72c71253f8eba10b"
]
]
},
{
"id": "72c71253f8eba10b",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "save msg.payload into flow.topic_text",
"rules": [
{
"t": "set",
"p": "topic_text",
"pt": "flow",
"to": "payload",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 860,
"wires": [
[]
]
},
{
"id": "265bcfa660b95831",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "ab311349d4b5cc9f",
"name": "save flow.topic_text into msg.topic",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "topic_text",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 940,
"y": 940,
"wires": [
[
"6733248e98f29d82",
"0bdc49908bd4f2f1"
]
]
},
{
"id": "5206964bfdc23d45",
"type": "comment",
"id": "4e424320f91a0972",
"type": "exec",
"z": "3bceb6b167ec8f8a",
"name": "Image",
"info": "",
"x": 850,
"g": "cef277eaea93cf97",
"command": "convert",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "10",
"winHide": false,
"oldrc": false,
"name": "Convert",
"x": 920,
"y": 140,
"wires": [
[
"d4274a7556fc52fd"
],
[
"ac11c7560fd51964"
],
[
"450b91f9f9995ab9",
"215e9359f56544ac"
]
]
},
{
"id": "d4274a7556fc52fd",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "stdout",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 100,
"wires": []
},
{
"id": "ac11c7560fd51964",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "stderr",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 140,
"wires": []
},
{
"id": "450b91f9f9995ab9",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "return",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 220,
"wires": []
},
{
"id": "ee884f98c1da8270",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "3f31d3a22e2ed424",
"name": "save msg.payload into flow.cluster2size",
"rules": [
{
"t": "set",
"p": "cluster2size",
"pt": "flow",
"to": "payload",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 740,
"wires": [
[
"913bc42e687c40dc"
]
]
},
{
"id": "356add1a97a5f06a",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "3f31d3a22e2ed424",
"name": "save msg.payload into flow.cluster1size",
"rules": [
{
"t": "set",
"p": "cluster1size",
"pt": "flow",
"to": "payload",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 660,
"wires": [
[
"bd55fb4e5bd7ca09"
]
]
},
{
"id": "ca8c09f033269fd4",
"type": "ui_text",
"z": "3bceb6b167ec8f8a",
"g": "3f31d3a22e2ed424",
"group": "e342ae49e88427ae",
"order": 3,
"width": 0,
"height": 0,
"name": "SIze cluster 2",
"label": "Size cluster 2 : ",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 600,
"y": 700,
"wires": []
},
{
"id": "f391acb6082be40f",
"type": "ui_text",
"z": "3bceb6b167ec8f8a",
"g": "3f31d3a22e2ed424",
"group": "e342ae49e88427ae",
"order": 3,
"width": 0,
"height": 0,
"name": "Size cluster 1",
"label": "Size cluster 1 : ",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 600,
"y": 620,
"wires": []
},
{
"id": "c084ef02cb008e01",
"type": "ui_text",
"z": "3bceb6b167ec8f8a",
"g": "b37cc1f0a54b395f",
"group": "e342ae49e88427ae",
"order": 3,
"width": 0,
"height": 0,
"name": "Loaded image",
"label": "Loaded image : ",
"format": "{{msg.filename}}",
"layout": "row-center",
"x": 1440,
"y": 620,
"wires": []
},
{
"id": "cc59fd7b9c9b3506",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "get filename and size from flow",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "image_filename",
"tot": "flow",
"dc": true
},
{
"t": "set",
"p": "size",
"pt": "msg",
"to": "cluster1size",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 80,
"wires": [
[
"c8a3cea728dcb733"
]
]
},
{
"id": "961a4eb72567178d",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "b37cc1f0a54b395f",
"name": "save msg.filename into flow.image_filename",
"rules": [
{
"t": "set",
"p": "image_filename",
"pt": "flow",
"to": "filename",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 660,
"wires": [
[]
]
},
{
"id": "c8a3cea728dcb733",
"type": "function",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "Build convertion string",
"func": "let pl = msg.payload;\nlet filename = msg.filename;\nlet raw_filename = filename.split(\".\")[0]\n//console.log(\"-scale \" + msg.size + \"! \" + \"/data/\" + filename + \" /data/\" + raw_filename + \".ppm\");\n// msg.payload = \"-scale 20x20! -interpolate Integer -filter point /data/graham.jpg /data/graham.png\"\nmsg.payload = \"-scale \" + msg.size + \"! \" + \"/data/\" + filename + \" /data/\" + \"current_image.ppm\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 140,
"wires": [
[
"4ca6c5aab2ed689f",
"4e424320f91a0972"
]
]
},
{
"id": "4ca6c5aab2ed689f",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "Convert string",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 200,
"wires": []
},
{
"id": "9bd7f64eef65d068",
"type": "comment",
"id": "215e9359f56544ac",
"type": "change",
"z": "3bceb6b167ec8f8a",
"name": "Text",
"info": "",
"x": 850,
"y": 380,
"g": "cef277eaea93cf97",
"name": "get filename from flow",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "image_filename",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1140,
"y": 180,
"wires": [
[
"832dd4609eeee57d"
]
]
},
{
"id": "832dd4609eeee57d",
"type": "function",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "Build full path",
"func": "msg.path = \"/data/\" + msg.filename\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1360,
"y": 180,
"wires": [
[
"e20cd041191b8d4e"
]
]
},
{
"id": "f47dec60f15aec1e",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "cef277eaea93cf97",
"name": "return",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1720,
"y": 240,
"wires": []
},
{
"id": "a2038022178487b0",
"id": "b826d57ee3a29903",
"type": "mqtt out",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "",
"topic": "toesp/text",
"topic": "cluster2/image",
"qos": "",
"retain": "",
"respTopic": "",
......@@ -440,51 +1099,283 @@
"correl": "",
"expiry": "",
"broker": "7c97b0098dfaf791",
"x": 1140,
"y": 400,
"x": 1740,
"y": 460,
"wires": []
},
{
"id": "20bcaabc7490baa3",
"id": "0559e96b14f3b3aa",
"type": "file in",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "read image",
"filename": "path",
"filenameType": "msg",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 1550,
"y": 460,
"wires": [
[
"b826d57ee3a29903",
"5a542a293c03214f"
]
]
},
{
"id": "87fd07530005b8d7",
"type": "ui_button",
"z": "3bceb6b167ec8f8a",
"name": "",
"group": "c33a1024a72aa169",
"g": "33e927adfa7339c6",
"name": "Send image cluster 2",
"group": "e342ae49e88427ae",
"order": 1,
"width": "2",
"height": "2",
"width": 10,
"height": 1,
"passthru": false,
"label": "button",
"label": "Send image to cluster 2",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "",
"topicType": "str",
"x": 530,
"y": 440,
"topic": "topic",
"topicType": "msg",
"x": 400,
"y": 360,
"wires": [
[
"36f36de07403b7d6"
"691a5ba5df37551b"
]
]
},
{
"id": "0bdc49908bd4f2f1",
"id": "1b58c8a5d3013bb3",
"type": "exec",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"command": "convert",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "10",
"winHide": false,
"oldrc": false,
"name": "Convert",
"x": 920,
"y": 420,
"wires": [
[
"4cd2b8e22daa26d1"
],
[
"2aafe2f8036cf29d"
],
[
"9b320aa0f05f6f60",
"706ccfd82d795270"
]
]
},
{
"id": "4cd2b8e22daa26d1",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"name": "debug 7",
"g": "33e927adfa7339c6",
"name": "stdout",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 380,
"wires": []
},
{
"id": "2aafe2f8036cf29d",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "stderr",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 420,
"wires": []
},
{
"id": "9b320aa0f05f6f60",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "return",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 500,
"wires": []
},
{
"id": "691a5ba5df37551b",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "get filename and size from flow",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "image_filename",
"tot": "flow",
"dc": true
},
{
"t": "set",
"p": "size",
"pt": "msg",
"to": "cluster2size",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 360,
"wires": [
[
"7827e7131abb42bd"
]
]
},
{
"id": "7827e7131abb42bd",
"type": "function",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "Build convertion string",
"func": "let pl = msg.payload;\nlet filename = msg.filename;\nlet raw_filename = filename.split(\".\")[0]\n//console.log(\"-scale \" + msg.size + \"! \" + \"/data/\" + filename + \" /data/\" + raw_filename + \".ppm\");\n// msg.payload = \"-scale 20x20! -interpolate Integer -filter point /data/graham.jpg /data/graham.png\"\nmsg.payload = \"-scale \" + msg.size + \"! \" + \"/data/\" + filename + \" /data/\" + \"current_image.ppm\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 420,
"wires": [
[
"ef46247ac204a721",
"1b58c8a5d3013bb3"
]
]
},
{
"id": "ef46247ac204a721",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "Convert string",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 480,
"wires": []
},
{
"id": "706ccfd82d795270",
"type": "change",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "get filename from flow",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "image_filename",
"tot": "flow",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1140,
"y": 460,
"wires": [
[
"fa69925fce69b14f"
]
]
},
{
"id": "fa69925fce69b14f",
"type": "function",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "Build full path",
"func": "msg.path = \"/data/\" + msg.filename\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1360,
"y": 460,
"wires": [
[
"0559e96b14f3b3aa"
]
]
},
{
"id": "5a542a293c03214f",
"type": "debug",
"z": "3bceb6b167ec8f8a",
"g": "33e927adfa7339c6",
"name": "return",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 440,
"x": 1720,
"y": 520,
"wires": []
}
]
\ No newline at end of file
src/server/nodered/data/graham.png

1.14 KiB

# This documents how to run the server
# This documents how to run the server on a Raspberry PI (3B)
## Install raspbian on the PI
We need to install a linux on the PI.
Download the Raspberry PI Imager on [https://www.raspberrypi.com/software/](https://www.raspberrypi.com/software/)
or on Ubuntu with :
```bash
sudo apt-install rpi-imager
```
https://docs.docker.com/engine/install/raspbian/
## Install and run
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment