# How to MQTT image from Raspi using Base64 and Template node

**URL:** <https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142>\
**Category:** Dashboard\
**Created:** [6 March 2021 10:46 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142 "2021-03-06T10:46:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reyner](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@Reyner](https://discourse.nodered.org/u/Reyner)\
**Post date:** [6 March 2021 10:46 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142/1 "2021-03-06T10:46:16Z")

</div>

I have a problem on publishing and receiving image that is taken from my camerapi using MQTT. Here is my flow:

```auto
[{"id":"e73e2624.4459a8","type":"inject","z":"e360ac5b.0ab79","name":"base 64 image","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"NR Test image","payload":"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABmJLR0QA/wD/AP+gvaeTAAALuUlEQVR4nO3deYxdVR3A8e90hS62laXQFoQoCIhgURDBjcW4EIIKBnElGg0IKgKRENGIgCFiUASXKEaUGEmMLJG4EWkVS6kbBUuVRSkttEVQ2g5LS9sZ//idm3fnzjnvzXTsLOX7SV7ue/fce+fOm/O755zfPbcFSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSSOma6RPYBtMAv4OPAmsBR4rLB8HekfoHKURcxRR8Tu9ZozUCWrHMW6kT2AbvH6A203brmehFwQDRGpjrAVIF9HFGggDREM2YaRPYJAOAnbJrO+lf8JhelrOBt4KrAFWp9dT2+sEtWMZawFS6l79C3hpY13VguwJ/LBRtgLYN73/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RBau+WzI94GPNNZtTuc8Ku6kGyCqDCSQZhKZtk6BVD2d2ckHiKcL67MbNlO+MTrsDBAN1vYOpHGMktYDDBBtH+No3cGfmpa5zzsTwVIlDDakz6toTbQcUQ7StT30EJW9+W91NY0nH0D+72CSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJOkF43+GSQModXZh1QAAAABJRU5ErkJggg==","payloadType":"str","x":160,"y":60,"wires":[["e5f61250.26cb4"]]},{"id":"e5f61250.26cb4","type":"base64","z":"e360ac5b.0ab79","name":"","action":"","property":"payload","x":320,"y":60,"wires":[["604a8eaf.6d4ac","d6ca2446.6053c8"]]},{"id":"604a8eaf.6d4ac","type":"change","z":"e360ac5b.0ab79","name":"Flow 3 : Setup mail content","rules":[{"t":"set","p":"cid","pt":"msg","to":"","tot":"date"},{"t":"set","p":"attachments","pt":"msg","to":"[{\t \"filename\": 'image_' & $replace($now(),\":\",\"_\") & '.jpg', \t \"content\": $$.payload,\t \"cid\": \"\" & cid & \"\"\t}]","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"See attached image","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"'<img src=\"cid:' & cid & '\"/>'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":120,"wires":[["58495115.e70dc","e7e50356.464ba"]]},{"id":"58495115.e70dc","type":"debug","z":"e360ac5b.0ab79","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":170,"y":200,"wires":[]}]

```

My goal is taking a picture when user press the Take Photo button and than that photo will be transferred to another node red that I have installed in a Cloud server (Bluemix from IBM) so that it can be accessed anywhere. Currently, I manage to display the photo locally (in my local node red in Raspi) but still cannot display the photo in my Bluemix node red.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 March 2021 10:55 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142/2 "2021-03-06T10:55:39Z")

</div>

Hi, first things first, your code is not importable unless you format your post correctly.  
Click the pencil icon to edit your 1st post and add triple backticks above and below the flow code

`````  
`[{flow here with - backticks above and below }]`  
`````

OK, so that flow looks like it sends an email not pass data over MQTT.

Also, the image data doent have a mime type (I can see from the first part of data `iVBOR` it is a PNG image. When you display the image in an `img` `src` you should have `data:image/jpeg;base64,` then the image data.

Also, I see you pass the image data through a base64 to convert it to a buffer - thats fine for emailing but you should probably send the base64 string as the MQTT payload.

---

<div class="post-metadata">

**Author:** ![Reyner](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@Reyner](https://discourse.nodered.org/u/Reyner)\
**Post date:** [8 March 2021 12:31 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142/3 "2021-03-08T12:31:19Z")

</div>

Sorry for not using the correct format, I'm new to this forum. I will use the correct format in my next post.  
Thankyou for your response but I'm not trying to send an email using MQTT. I am trying to display the picture taken using my raspi camera to my NR dashboard installed in IBM Cloud. My fault not inserting the flow in my NR dashboard installed in IBM Cloud. Here is my flow in NR dashboard installed in IBM Cloud:

```auto
[{"id":"e56b6718.c5d278","type":"ui_button","z":"3a18cd09.a5abc2","name":"","group":"f1395852.3a74f8","order":5,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":1230,"y":804,"wires":[["44d58bbc.3abd14"]]},{"id":"44d58bbc.3abd14","type":"mqtt out","z":"3a18cd09.a5abc2","name":"","topic":"Control/Photo1","qos":"","retain":"","broker":"933bb4dd.225038","x":1420,"y":804,"wires":[]},{"id":"bc86bdb1.303a","type":"mqtt in","z":"3a18cd09.a5abc2","name":"","topic":"Control/Photo","qos":"2","datatype":"auto","broker":"933bb4dd.225038","x":1230,"y":880,"wires":[["65631e77.4adfa"]]},{"id":"65631e77.4adfa","type":"ui_template","z":"3a18cd09.a5abc2","group":"f1395852.3a74f8","name":"","order":5,"width":0,"height":0,"format":"\n \n <img width=\"100%\" height=\"100%\" src=\"data:image/jpeg;base64,{{msg.payload}}\" />\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1400,"y":880,"wires":[[]]},{"id":"f1395852.3a74f8","type":"ui_group","z":"","name":"Control","tab":"2c212c27.10ea24","order":4,"disp":true,"width":"6","collapse":true},{"id":"933bb4dd.225038","type":"mqtt-broker","z":"","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2c212c27.10ea24","type":"ui_tab","z":"","name":"Home","icon":"fa-home","order":1,"disabled":false,"hidden":false}]

```

Combine with this flow in my local NR:

```auto
[{"id":"156432ee.35ed3d","type":"camerapi-takephoto","z":"678b622e.d861ac","filemode":"1","filename":"photo1.JPEG","filedefpath":"0","filepath":"/home/pi/Pictures/","fileformat":"jpeg","resolution":"1","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":620,"y":340,"wires":[[]]},{"id":"a9217910.729008","type":"ui_button","z":"678b622e.d861ac","name":"","group":"f1395852.3a74f8","order":5,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":410,"y":340,"wires":[["156432ee.35ed3d"]]},{"id":"ddca81cc.4ea38","type":"ui_template","z":"678b622e.d861ac","group":"f1395852.3a74f8","name":"","order":6,"width":"6","height":"6","format":"\n \n <img width=\"100%\" height=\"100%\" src=\"data:image/jpeg;base64,{{msg.payload}}\" />\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1060,"y":380,"wires":[[]]},{"id":"8a19d4fa.1ccf58","type":"base64","z":"678b622e.d861ac","name":"","action":"str","property":"payload","x":900,"y":380,"wires":[["b65d5b32.054eb8","ddca81cc.4ea38"]]},{"id":"7f147852.0ef8d8","type":"file in","z":"678b622e.d861ac","name":"","filename":"/home/pi/Pictures/photo1.JPEG","format":"","chunk":false,"sendError":false,"encoding":"none","x":670,"y":380,"wires":[["8a19d4fa.1ccf58"]]},{"id":"fa84e6da.fa5cb8","type":"inject","z":"678b622e.d861ac","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":430,"y":380,"wires":[["7f147852.0ef8d8"]]},{"id":"97d06936.abbf48","type":"mqtt in","z":"678b622e.d861ac","name":"","topic":"Control/Photo1","qos":"2","datatype":"auto","broker":"4d8478fc.0ef098","x":420,"y":280,"wires":[["156432ee.35ed3d"]]},{"id":"b65d5b32.054eb8","type":"mqtt out","z":"678b622e.d861ac","name":"","topic":"Control/Photo","qos":"","retain":"","broker":"4d8478fc.0ef098","x":1080,"y":320,"wires":[]},{"id":"f1395852.3a74f8","type":"ui_group","name":"Control","tab":"2c212c27.10ea24","order":4,"disp":true,"width":"6","collapse":true},{"id":"4d8478fc.0ef098","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2c212c27.10ea24","type":"ui_tab","name":"Home","icon":"fa-home","order":1,"disabled":false,"hidden":false}]

```

I am trying to display the image in my NR dashboard installed in IBM Cloud. But right now it is not working. The image taken only displayed in the local NR dashboard and not in the NR dashboard installed in IBM Cloud.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 March 2021 19:51 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142/4 "2021-03-08T19:51:06Z")

</div>

> [@Reyner](#):
>
> I will use the correct format in my next post

Almost - you need the backticks above and below (on their own lines) (I'll edit it again)

  
  

> [@Reyner](#):
>
> Thankyou for your response but I'm not trying to send an email using MQTT

I never said you were. I said ...

> [@Steve-Mcl](#):
>
> so that flow looks like it sends an email not pass data over MQTT

And I said that because you posted the following flow...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b5d20fc5e2efc50e1be4fdd52c1d6d99fc811d26.png)

  
  

* * *
  

Anyhow, onto your issues...

  

> [@Reyner](#):
>
> I am trying to display the image in my NR dashboard installed in IBM Cloud. But right now it is not working. The image taken only displayed in the local NR dashboard and not in the NR dashboard installed in IBM Cloud.

there were a couple of things wrong. As I dont run an IBM Cloud instance, I have tweaked things around to get it working on a PI...

flow...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fd04f0d43e1c74b3085ededab6a074adfc84f0b.jpeg)

dashboard...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e9ef108517731a0a04c901ccd337d6be959959b.jpeg)

demo flow...

```auto
[{"id":"ed24352e.c554d8","type":"image viewer","z":"c966426a.35dc8","name":"","width":"140","data":"payload","dataType":"msg","x":1042,"y":768,"wires":[["3eed774d.91df08"]]},{"id":"e56b6718.c5d278","type":"ui_button","z":"c966426a.35dc8","name":"","group":"2a53ae0e.c22ef2","order":2,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":1030,"y":224,"wires":[["44d58bbc.3abd14"]]},{"id":"44d58bbc.3abd14","type":"mqtt out","z":"c966426a.35dc8","name":"","topic":"myapp/control/take_photo","qos":"","retain":"","broker":"933bb4dd.225038","x":1438,"y":224,"wires":[]},{"id":"bc86bdb1.303a","type":"mqtt in","z":"c966426a.35dc8","name":"","topic":"myapp/response/photo","qos":"2","datatype":"auto","broker":"933bb4dd.225038","x":1060,"y":288,"wires":[["15d91d02.fed173","1b1a0556.14207b","19380c57.bd1cc4"]]},{"id":"3f79f384.ec8dfc","type":"ui_button","z":"c966426a.35dc8","name":"","group":"f80260c9.08249","order":2,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":1030,"y":656,"wires":[["4fbf613a.54b1e"]]},{"id":"c9d1b497.260c58","type":"file in","z":"c966426a.35dc8","name":"","filename":"/home/pi/Pictures/photo1.JPEG","format":"","chunk":false,"sendError":false,"encoding":"none","x":1282,"y":704,"wires":[["2dbac17c.9187ee"]]},{"id":"254d0583.26b7ca","type":"inject","z":"c966426a.35dc8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1020,"y":704,"wires":[["c9d1b497.260c58"]]},{"id":"de31de65.7c008","type":"mqtt in","z":"c966426a.35dc8","name":"","topic":"myapp/control/take_photo","qos":"2","datatype":"auto","broker":"933bb4dd.225038","x":1070,"y":608,"wires":[["4fbf613a.54b1e"]]},{"id":"5c725d4e.c183e4","type":"mqtt out","z":"c966426a.35dc8","name":"","topic":"myapp/response/photo","qos":"","retain":"","broker":"933bb4dd.225038","x":1764,"y":704,"wires":[]},{"id":"ebaed7.94117128","type":"comment","z":"c966426a.35dc8","name":"IBM Cloud end","info":"","x":1040,"y":184,"wires":[]},{"id":"70abc57e.d9041c","type":"comment","z":"c966426a.35dc8","name":"Local end","info":"","x":1020,"y":560,"wires":[]},{"id":"15d91d02.fed173","type":"debug","z":"c966426a.35dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1126,"y":336,"wires":[]},{"id":"1b1a0556.14207b","type":"image viewer","z":"c966426a.35dc8","name":"","width":"140","data":"payload","dataType":"msg","x":1490,"y":336,"wires":[[]]},{"id":"4fbf613a.54b1e","type":"camerapi-takephoto","z":"c966426a.35dc8","filemode":"0","filename":"photo1.JPEG","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"1","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":1328,"y":656,"wires":[["2dbac17c.9187ee"]]},{"id":"2dbac17c.9187ee","type":"base64","z":"c966426a.35dc8","name":"","action":"str","property":"payload","x":1532,"y":704,"wires":[["5c725d4e.c183e4","ed24352e.c554d8","17502aa4.5e01f5"]]},{"id":"17502aa4.5e01f5","type":"debug","z":"c966426a.35dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1798,"y":752,"wires":[]},{"id":"19380c57.bd1cc4","type":"template","z":"c966426a.35dc8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img height=\"320px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":1340,"y":288,"wires":[["81bd5139.448d1"]]},{"id":"81bd5139.448d1","type":"ui_template","z":"c966426a.35dc8","group":"2a53ae0e.c22ef2","name":"","order":0,"width":"6","height":"7","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1484,"y":288,"wires":[[]]},{"id":"3eed774d.91df08","type":"template","z":"c966426a.35dc8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img height=\"320px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":1196,"y":768,"wires":[["ea3320aa.dc7fd"]]},{"id":"ea3320aa.dc7fd","type":"ui_template","z":"c966426a.35dc8","group":"f80260c9.08249","name":"","order":0,"width":"6","height":"7","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1356,"y":768,"wires":[[]]},{"id":"2a53ae0e.c22ef2","type":"ui_group","name":"IBM Cloud","tab":"eb34fe8.0da08","order":2,"disp":true,"width":"6","collapse":false},{"id":"933bb4dd.225038","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f80260c9.08249","type":"ui_group","name":"Local","tab":"eb34fe8.0da08","order":1,"disp":true,"width":"6","collapse":false},{"id":"eb34fe8.0da08","type":"ui_tab","name":"Demo","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 April 2021 19:52 UTC](https://discourse.nodered.org/t/how-to-mqtt-image-from-raspi-using-base64-and-template-node/42142/5 "2021-04-07T19:52:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
