{"id":5414,"date":"2026-08-28T08:00:46","date_gmt":"2026-08-28T15:00:46","guid":{"rendered":"https:\/\/www.cloudacm.com\/?p=5414"},"modified":"2026-08-27T21:45:59","modified_gmt":"2026-08-28T04:45:59","slug":"desktop-capture-to-node-red-via-mqtt","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=5414","title":{"rendered":"Desktop Capture to Node Red via MQTT"},"content":{"rendered":"<p>This post uses a similar process to an earlier post (<a href=\"https:\/\/www.cloudacm.com\/?p=3974\">https:\/\/www.cloudacm.com\/?p=3974<\/a>) where images are piped through a MQTT broker. This post will not be using FFMpeg or images captured with a camera. Instead it will use a native application to capture the desktop screen.<\/p>\n<p><a href=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Node-Red.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5415 aligncenter\" src=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Node-Red.png\" alt=\"\" width=\"440\" height=\"315\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Node-Red.png 440w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Node-Red-300x215.png 300w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Node-Red-377x270.png 377w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/a><a href=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Desktop.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5416\" src=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Desktop.png\" alt=\"\" width=\"440\" height=\"315\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Desktop.png 440w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Desktop-300x215.png 300w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Widget-Desktop-377x270.png 377w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/a><\/p>\n<p>PowerShell is a Windows native application that will be used to capture the desktop. PowerShell will call a MQTT publish process to forward the base64 data to a broker. Although the MQTT application is not native, there are other processes that can handle the data in a similar way.<\/p>\n<pre>\r\nPowerShell.exe\r\n-WindowStyle hidden -NoProfile -Command \"Add-Type -AssemblyName System.Windows.Forms, System.Drawing; while($true) { $b = New-Object System.Drawing.Bitmap([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width, [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height); $g = [System.Drawing.Graphics]::FromImage($b); $g.CopyFromScreen(0, 0, 0, 0, $b.Size); $r = New-Object System.Drawing.Bitmap($b, [int]($b.Width * 180 \/ $b.Height), 180); $fp = 'C:\\Tasks\\Desktop.png'; $r.Save($fp); Start-Sleep -Milliseconds 500; &amp; mosquitto_pub -h &lt;MQTTBrokerHost&gt; -t &lt;TopicHost&gt;\/Desktop -f $fp; $g.Dispose(); $b.Dispose(); $r.Dispose(); Start-Sleep -Seconds 10 }\"\r\n<\/pre>\n<p>Windows Task Scheduler will be used to run the command when a user logs into the system. The argument for the PowerShell command is the workhorse of this demo. It defines how often the capture occurs and the broker to send the data to. The scheduled task will need to be set up so that it only runs when a user has logged on.<\/p>\n<p><a href=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5417 size-full\" src=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow.png\" alt=\"\" width=\"1165\" height=\"83\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow.png 1165w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow-300x21.png 300w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow-1024x73.png 1024w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow-768x55.png 768w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2026\/08\/Node-Red-Flow-604x43.png 604w\" sizes=\"auto, (max-width: 1165px) 100vw, 1165px\" \/><\/a><\/p>\n<p>The Node Red flow is similar to the earlier video stream process. The key difference is that the base64 data originates from the subscribed MQTT topic. All other aspects of the flow are identical to the earlier demo.<\/p>\n<p><a href=\"https:\/\/github.com\/cloudacm\/Desktop-Capture-to-Node-Red-via-MQTT\">https:\/\/github.com\/cloudacm\/Desktop-Capture-to-Node-Red-via-MQTT<\/a><\/p>\n<p>It should be noted that this is a demonstration and in no way is intended to be used in a production environment or for any other purpose. The argument code was generated using an AI model as a feasibility test.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post uses a similar process to an earlier post (https:\/\/www.cloudacm.com\/?p=3974) where images are piped through a MQTT broker. This post will not be using FFMpeg or images captured with a camera. Instead it will use a native application to capture the desktop screen. PowerShell is a Windows native application that will be used to capture the desktop. PowerShell will call a MQTT publish process to forward the base64 data to a broker. Although the MQTT application is not native,&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=5414\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5414","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/5414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5414"}],"version-history":[{"count":5,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/5414\/revisions"}],"predecessor-version":[{"id":5420,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/5414\/revisions\/5420"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}