Saving Canvas to Internal Storage


How should I go about saving a Canvas to an Android 10+ internal storage? I have looked through the other threads and understand that I have to save the canvas to shared storage for it to appear in the Gallery.

However, when I attempt to do so, it seems to save the file to the App Specific Directory and will then not be visible in the Gallery. I have also tried to run the demo by Taifun and received the same result.

Try your code compiled as an APK. Also, save directly to an existing folder. You should be able to save directly to the Download folder.



Edit: Apparently DCIM is a shared folder.

Try this:

works in companion app for me

Ah yes - my App saves to Pictures, but when I checked, the image is saved to the ASD and then moved to Pictures using the TaifunFile extension - my bad. It also needs the TaifunTools "GalleryRefresh" function.

Sorry my post was misleading chonker.

Hello! Thank you for the help! When I tried using this (whether with the AI Companion App or built as an apk), I realised there was some latency in that I had to close the app and refresh the gallery manually before the pictures appeared.

Would you have any idea what could be causing this and how I could go about eliminating this?

No worries Chris! Thanks for the help nonetheless, though I found that using TIMAI2's method seemed to work whilst my original code, even compiled as an apk didn't. Did my original code using taifun's tools manage to work for you?

This was not my experience. I added an imagePicker to my test app, and after saving and copying the canvas image, I was able to find the image using the imagepicker straight away. Could just be my file manager/s being more efficient on my device.

Show your final blocks (especially the .GalleryRefesh block).

hello! my current final blocks would be as TIMAI2 pasted.

Not too sure why I couldn’t get the .GalleryRefresh to work for me as I attempted to adapt the solutions to the many existing threads that either you or taifun had given advice on :sweat_smile:

I don't see a Gallery refresh block there. So show your blocks (all).

Hi! I've tried to incorporate the Gallery Refresh block as such, the canvas image still doesn't appear in my gallery immediately though...

Thanks everyone for their input! After cross-referencing with even more posts about the Gallery Refresh method (such as this Refresh Gallery).

I managed to get the images to update directly using these as the final blocks

As I pointed out several times in the last years, the .RefreshGallery method doesn't work with a full path nor a relative path. You must use an absolute path.

@Taifun might want to explain the reason for this (after all these years and countless questions).

I'm missing some permissions blocks for Android 11+, 13+ and Android < 11.

Reading the documentation would have helped...

Gallery Refresh for a specific filename. Note : you will have to use an absolute path to the file, for example /storage/emulated/0/DCIM/myImage.jpg , Returns the filename.

Thank you for using the tools extension

That's the wrong question
The correct question is, why @chonker did not consider to read the documentation...
If you are tired to answer those questions, just don't do it


Hello! I’m fairly new to this hence I didn’t quite understand the documentation (tried to download and run the sample sia attached in the documentation but it didn’t quite work) hence I was asking for advice :sweat_smile:

Thank you for the reply though and everyone else for the help!

I don't think so, because I find it interesting to know the reason why it only works with an absolute path. AFAIK there is no path restriction in any other of your extensions.

Let me know how to improve it

Great! I will check the example, probably it needs an update


This post is about saving a Canvas Image to the device's internal storage.

" Saving Canvas to Internal Storage" suggests saving to a database, e.g. ordinates and colours etc of geometry (which could therfore be re-drawn on reload of the App).