Might not be what you're looking for, but might give an idea that there are different ways to Rome. I was editing a few hundred photos with the only goal to scale them down in file size to be displayed on a low resolution display. Most were taken with a DSLR camera, so the file size for regular JPEGs was about 8mb per photo, but not all were. Since it was a task that could be easily dumbed down to not spend hours on doing it by hand, I put Node-RED to use for its ease in prototyping.
It uses a few custom nodes, but you should only care about the use of q-gate here: [ANNOUNCE] node-red-contrib-queue-gate
The idea is that
Files
has an output that's spamming 100+ messages rapidly into the q-gate, which is set to queueing mode, where a single message will come out, actions happen, and at the end with a change node it goes back into the q-gate to allow the next message to pass through. You could have the commands get send into the q-gate, then branch and send the message into the serial out, and another into a delay note with 1 second delay, with the output of that one going back into q-gate with a command set to let the next message pass through.
Or perhaps even easier, if you can get it to work with the delay node set to rate limiting and only let 1 message pass every second.
[{"id":"408bd314.dccd24","type":"jimp-image","z":"fe5232bf.c0c7f","name":"","data":"payload","dataType":"msg","ret":"img","parameter1":"50","parameter1Type":"num","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","parameterCount":1,"jimpFunction":"quality","selectedJimpFunction":{"name":"quality","fn":"quality","description":"Set the quality of the image. Usefull for reducing size of image before calling the write function.","parameters":[{"name":"quality","type":"num","required":true,"hint":"Quality value 1 ~ 100"}]},"x":790,"y":40,"wires":[["b53c1817.58c57"]]},{"id":"feae1e2e.0fcff","type":"jimp-image","z":"fe5232bf.c0c7f","name":"","data":"payload","dataType":"msg","ret":"img","parameter1":"filename","parameter1Type":"msg","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","parameterCount":1,"jimpFunction":"write","selectedJimpFunction":{"name":"write","fn":"write","description":"Write to file. NOTE: You can specify an alternative file extension type to change the type. Currently support types are jpg, png, bmp.","parameters":[{"name":"filename","type":"str","required":true,"hint":"Name of the file","defaultType":"str"}]},"x":1010,"y":40,"wires":[["4b36ff8c.bc8668"]]},{"id":"abd6a9ce.12cc88","type":"inject","z":"fe5232bf.c0c7f","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":40,"wires":[["68713e15.0203a"]]},{"id":"b53c1817.58c57","type":"function","z":"fe5232bf.c0c7f","name":"Rename","func":"msg.filename = `${msg.filename.split('.JPG')[0]}_klein.jpg`;\nreturn msg;","outputs":1,"noerr":0,"x":915,"y":40,"wires":[["feae1e2e.0fcff"]],"l":false},{"id":"f6c8cd59.1637a8","type":"jimp-image","z":"fe5232bf.c0c7f","name":"Load ","data":"payload","dataType":"msg","ret":"img","parameter1":"","parameter1Type":"msg","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","parameterCount":0,"jimpFunction":"none","selectedJimpFunction":{"name":"none","fn":"none","description":"Just loads the image.","parameters":[]},"x":650,"y":40,"wires":[["408bd314.dccd24"]]},{"id":"68713e15.0203a","type":"fs-file-lister","z":"fe5232bf.c0c7f","name":"Files","start":"/home/pi/photo/katachtigen/","pattern":"*.JPG","path":true,"single":false,"depth":"1","stat":false,"x":230,"y":40,"wires":[["9d667618.ed8ee8","7a566e96.2c972"]]},{"id":"9d667618.ed8ee8","type":"q-gate","z":"fe5232bf.c0c7f","name":"","controlTopic":"gatectrl","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","maxQueueLength":"-1","keepNewest":false,"qToggle":false,"persist":false,"x":410,"y":40,"wires":[["c0744ffa.1f09e8","18389d79.a1ee03"]]},{"id":"4b36ff8c.bc8668","type":"change","z":"fe5232bf.c0c7f","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"gatectrl","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"trigger","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":120,"wires":[["9d667618.ed8ee8"]]},{"id":"40d6790b.94bfa8","type":"inject","z":"fe5232bf.c0c7f","name":"Start converting","topic":"gatectrl","payload":"trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":180,"wires":[["9d667618.ed8ee8"]]},{"id":"2f31fc9f.1c2174","type":"inject","z":"fe5232bf.c0c7f","name":"Reset queue","topic":"gatectrl","payload":"reset","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":240,"wires":[["9d667618.ed8ee8"]]},{"id":"c0744ffa.1f09e8","type":"debug","z":"fe5232bf.c0c7f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":470,"y":120,"wires":[]},{"id":"18389d79.a1ee03","type":"change","z":"fe5232bf.c0c7f","name":"(safekeeping)","rules":[{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":555,"y":40,"wires":[["f6c8cd59.1637a8"]],"l":false},{"id":"7a566e96.2c972","type":"debug","z":"fe5232bf.c0c7f","name":"Files","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":190,"y":120,"wires":[]}]