# NoteHub to Image data

**URL:** <https://discuss.blues.com/t/notehub-to-image-data/1510>\
**Category:** Notehub.io\
**Tags:** python, encryption\
**Created:** [July 19, 2023, 6:28pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510 "2023-07-19T18:28:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/pradeep/32/479_2.png) [@Pradeep](https://discuss.blues.com/u/Pradeep)\
**Post date:** [July 19, 2023, 6:28pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/1 "2023-07-19T18:28:31Z")

</div>

Hi All,

I’m trying to send and receive an image payload using a notecard. I can see my encoded image payload in the notehub,

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/422012ec7ea871c4dba55ffdeaac1f18357e1f10.png)

but I can’t read back the payload. I’m using this ref python script  
([https://github.com/CarltonHenderson/portal/blob/3b2158708d6be15ec1f8d179f0d787b244705ed3/notecomm.py#L48](https://github.com/CarltonHenderson/portal/blob/3b2158708d6be15ec1f8d179f0d787b244705ed3/notecomm.py#L48)) with some modifications.

Here is my sketch and Its output log.  
[Notecard\_img(python).txt](https://discuss.blues.com/uploads/short-url/hhLKuogkKUwmg65n5g8GtfCgToD.txt) (1.8 KB)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/f2d166c9cdc98b128fbfab2e17e3009cb9643776.png)

I’m not sure what I’m missing. Let me know your comments.

Regards,  
Pradeep S.

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [July 20, 2023, 1:43pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/2 "2023-07-20T13:43:34Z")

</div>

Hi @Pradeep,

I can see a couple of things going on here:

1. Try putting the base64-encoded string in the `payload` of the Note, not in the `body` (and use a [Note template](https://dev.blues.io/notecard/notecard-walkthrough/low-bandwidth-design/)). Anything in the `payload` field will be transferred over the air as compressed binary.
2. You’re sending `image.qo` and then trying to retrieve the same data with `image.qi`, but that’s not how Notehub works. `.qo` are outbound (from Notecard to cloud) and `.qi` are inbound (from cloud to Notecard). You need to either route that `image.qo` Note to a service that processes the image, use the Notehub API to query for that specific Note/event, or (possibly) use a [.db Notefile](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data/#using-database-files-for-replicated-state) to sync the `payload` between cloud and device.

Hope that helps!  
Rob

---

<div class="post-metadata">

**Author:** ![Pradeep](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/pradeep/32/479_2.png) [@Pradeep](https://discuss.blues.com/u/Pradeep)\
**Post date:** [July 20, 2023, 3:54pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/3 "2023-07-20T15:54:56Z")

</div>

Hi @RobLauer,

Thanks for the guidance. Now I’m trying to send that “image” data to Qubitro via MQTT. But it looks like it’s only transferring this data, not my image data.

Data in notehub:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/28a3e6724e9dc4d8e930f92157d2b649e6b5445e.png)

Data in Qubitro portal:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/0b304d8f20c3cf586ca720e1c360b0663ad99982.png)

Also I have tried the webhooks, and that’s working fine.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/6605fa6cee51c8d973fe7748b44ab095332817ef.png)

I have ensured the Qubitro’s payload size by directly sending the base64 to Qubitro via Python MQTT and it works. So, are there any limitations in notehub or am I doing anything wrong?

Regards,  
Pradeep S.

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [July 20, 2023, 8:46pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/4 "2023-07-20T20:46:40Z")

</div>

Are you delivering the base64-encoded string data in the `payload` field now? If you’re not using templated Notes, you are limited to 250 bytes of data in the payload, but I don’t think that is the issue here.

---

<div class="post-metadata">

**Author:** ![Pradeep](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/pradeep/32/479_2.png) [@Pradeep](https://discuss.blues.com/u/Pradeep)\
**Post date:** [July 21, 2023, 8:48am UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/6 "2023-07-21T08:48:00Z")

</div>

Yes, I have tried to send that via payload file but it limits me. So, just kept in the body. But the thing is I can retrieve the Base64 via webhooks but I don’t know why it’s not visible on MQTT.

---

<div class="post-metadata">

**Author:** ![Pradeep](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/pradeep/32/479_2.png) [@Pradeep](https://discuss.blues.com/u/Pradeep)\
**Post date:** [July 21, 2023, 2:56pm UTC](https://discuss.blues.com/t/notehub-to-image-data/1510/7 "2023-07-21T14:56:07Z")

</div>

Hi @RobLauer, I have tried to reduce my data size and tried that and it works. So, I think the reason is the MQTT connection. Let me know your comments. But I’m curious about how it works in webhooks.
