I can't thank you enough, I was just staring to stumble around the Pillow docs to figure out how to do this.
The need arose as a friend is running my system on Windows 10 but since it also hosts an externally accessible web-site I advised him not to install the node-red, but to run the notification on a Raspberry Pi (that he already had on hand), which of course meant I "volunteered" to modify my code to support this.
Your python pic_send_via_mqtt.py script solves the issue completely by inserting the four lines that are the "guts" of composing the buffer to be send via MQTT into my code.
Thanks again.
I've "unified" my code to run on Linux or Windows, use multiple NCS sticks if available and fall back to the DNN module if NCS is not available or run one CPU AI thread in addition to one thread for each NCS installed.
I'm finding a single i3 software only is about as fast as the NCS on the Raspberry Pi3B+ ~6.5 fps. The i3 with one CPU AI and one NCS is getting ~16 fps.
On my i7 desktop with everything else I do still running, 1 CPU AI thread and 1 NCS thread hits ~38 fps getting frames from 15 rtsp camera threads. These can often be "camera limited" as the AI can be starved for frames lowering the composite framerate, took 15 rtps streams to apparently saturate the AI subsystem on my i7 -- I didn't have enough http snapshot cameras to do it.
I've found rtsp mp4 streams can feed frames to the AI at a higher rate than http "snapshots" or ftp but the latency is very much worse.
I will share my code after I fix a few things, but the NCS stuff has a monkey wrench thrown by Intel. They introduced an NCS SDK v2 which broke all existing code, I wasted some time with it but it offered no performance benefits I could see. Then they came out the the Movidius NCS2 but the NCS SDK v2 didn't support it, only there "OpenVINO" code. This is where I plan to move my code to as it "seamlessly" supports CPU AI and NCS/NCS2.
I don't have a timeline, but your send images via MQTT was one of the "more time consuming" items on my TODO list! I'm still debating if there is a need to allow mixing rtsp stream cameras with http snapshot cameras, right now its either/or via a command line option.