Node-REDで画像処理_sharp_CODE

15th August 2021 at 11:59pm
[
    {
        "id": "b4ef144d424bce74",
        "type": "inject",
        "z": "c2f97dc56d34ab2d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 120,
        "wires": [
            [
                "a2f6f3adcb37ef37"
            ]
        ]
    },
    {
        "id": "a2f6f3adcb37ef37",
        "type": "function",
        "z": "c2f97dc56d34ab2d",
        "name": "",
        "func": "msg.payload = await sharp(\"c:/tmp/lena.jpg\")\n    .blur(10)\n    .toBuffer();\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [
            {
                "var": "sharp",
                "module": "sharp"
            }
        ],
        "x": 380,
        "y": 120,
        "wires": [
            [
                "7c7a4c1120d017a7"
            ]
        ]
    },
    {
        "id": "7c7a4c1120d017a7",
        "type": "image",
        "z": "c2f97dc56d34ab2d",
        "name": "",
        "width": 160,
        "data": "payload",
        "dataType": "msg",
        "thumbnail": false,
        "active": true,
        "pass": false,
        "outputs": 0,
        "x": 560,
        "y": 120,
        "wires": []
    }
]