Jpeg image view using Bluetooth

Hi ,

I'm new to creating app and I though this is the best way to build an app for my project . I have arduino which can take pictures using arducam . I need to build an app to view the image .

As first step I manage to search for Bluetooth and connect to the device using an example .

I add another to button to cake snapshot ;

next step to accept image data and show the image (this is the part that i'm having issues with )
I read some comments online and used image block convert to base64 and view the jpeg image but It didn't work as expected .

Appreciate if someone can help me to sort this problem or guide me with a proper solution .

Thanks in advance .

Try this

Thanks Juan for your response ,in my case instead of sending as a text to the app the camera sends the jpeg data in binary format ,so will I be able to still use this method?

Give it a try, this method converts a file to String Base64 and sends that String. Try small files < 80Kb first.

Thanks, ill give it a try .

Hi @Juan_Antonio ,

I tried the method you provided. It seems that you need to save the base64 data to a JPG file and then retrieve it to display the image on the phone.

In my case, I want to decode the base64 image data (which is captured from Arducam and converted to a base64 string) and display it right away. I tried connecting the received string block directly to the .base64toImage block as shown below:

However, it's giving me a runtime error "bad base-64". When I use list view to display the received data, I can see the whole frame received as a base64 string. So, I'm not exactly sure why the error occurs.

I also tried copying a base64 JPEG frame from camera and pasting it into a text box to see if it displays the image properly, and that works:

My question is, for the incoming string data, do we still need to copy the JPEG frame as a base64 string to a file in order to display the image? Or is there a way to decode it right away and show the JPEG image (Similar method as showed in the first image ?

Appreciate your help.
Thanks, Samson.

BLE sends 24-byte packets.

https://community-appinventor-mit-edu.ezproxy.canberra.edu.au/t/ble-esp32-bluetooth-send-receive-arduino-ide-multitouch/1980

https://community-appinventor-mit-edu.ezproxy.canberra.edu.au/t/send-file-via-ble-to-esp32/26883/8

Thank you for the prompt response @Juan_Antonio , is there a method or example that can append all the received bytes in that frame and send to decode ? Instead of saving in to a file and decode to file to an image ?

Thanks.

Seems like this method works ,

Thanks.