πŸ–Ό Base64 Tools - five little ones ;)

Hello.
I would like some help on how to convert Canvas to Base64. I've tried many variations (ANKE, TIMAI etc...) but it doesn't work.
I would like to upload the image converted into a string to firebase.
Everything works, but the saved data gets the value ("File not found.").
image

My Android version is 12, API 31.

Just use:

Canvas to Base64

no need to create a file

Thanks for the quick response.
Yes, that's what I started with. CameraBase64 works perfectly, the received string is also added to firebase. Unfortunately, what I would need is to convert a modified image (canvas) and not a camera captured image. The installed extensions:
image
Here is your suggested test and the error message at runtime. (All direct canvas conversions give the same error)
4
5
3

Just tested, and you are correct, it throws that error. Not sure what has changed to make this happen....will need to do some testing.

This part doesn't throw an error, but I don't know where exactly it saves the file. Maybe it doesn't even save? Or have the libraries been changed again in the newer android version?
7

Of course, it would be better if the direct conversion worked...

Usually in the ASD... also depending on how you set the default file scope in the Screen1 properties...

Taifun

DefaultFileScope = "App". I guess that's okay.
Maybe it could be "Shared"?

In a last post, Anke wrote:

Should I enable readout (Image)?

I tried to enable it, but it gives me this error:
9

Now fixed, download extension again, and restart companion, and try again. You may find it a bit slow with complex images, so perhaps use the progress dialog or similar....

Canvas to Base64

All credits to @Kumaraswamy for his quick response and fix :slight_smile:

1 Like

Thank you very much. I will try it soon and give feedback. Have a good day.

Thank you very much for your very quick response. It works perfectly fine. There is no problem with "a little slowness", as I have options to avoid this observation. It does its job. I wish I knew how and how you do this.

The code is provided above in the first post

5 posts were split to a new topic: Canvas Bug - Image Reload hides arrangements

Update

Now added a fifth "little one", Base64Convertor.

This will convert a binary file to a base64 string, and convert a suitable base64 string to a binary file.

You will have to set absolute paths (possibly full paths in some circumstances) to the files...

You can download this extension from the first post in this topic.

3 Likes

Really useful extension, I was searching for :laughing:

Which one? ( I am guessing Base64Convertor)

1 Like

ImageToBase64 is what I was searching for😁

Not Working ImageTobase64,

Image not loading fully.

This below is load by picture picker :

Don't load the base64 string to either a label or textbox, invariably AI2 cannot handle it. Store it only to a variable.

It is only stored in the Variable as you can also see above in the image,

Label1 carries the path of the image got from filePicker.