How to save component image in external storage of device?

Hello Koders,

This is my first tutorial and today I will share the steps to convert component to image and save that image in the external storage of device.

Extensions Used : I have used two extensions both are free so import them first.

  1. Component to Image ;
  1. Taifun Tool ;

Step 1 :
blocks (2)

Step 2 :

Vertical_Arrangement1 replace this block with the block of component, you wants to save the image.

Step 3 :


GalleryRefresh block will refresh the gallery when the image saved so image will automatically shown in gallery app.

Note : filename.png is the name of image file saved in storage. It should be same everywhere I used filename.png.
The root directory of the External Storage is /storage/emulated/0/ , you can also replace this with /storage/82C3-E96C/ to save image in External (removable / micro) SD card.

Save Image in Sub Directory ; you can also replace this path with any other subdirectory, e.g.:

  • /storage/emulated/0/Download/ or
  • /storage/emulated/0/Download/DCIM/

Note : It is not possible to save image in external removable sd card in API 19, Android 4.4 / KitKat or higher.

I have made this guide because many users reported that the image didn’t display automatically in gallery and I have also faced the same issue.

Credit

  1. @Jerin_Jacob for Component to Image Extension
  2. @Taifun for Taifun Tool Extension
  3. Kodular Creator and Community
8 Likes

Thanks so much, nice Guide !!!

1 Like

Very Nice !! Keep Koding !!

1 Like

Nice guide @ramrajput200021 :+1:t2:

Nice guide.

Please read this guide and clarify the terms “Internal Storage” and “External Storage”:

According to your definition / understanding of the terms, it is not possible to save a file in the external storage (→ removeable / micro SD card) since API 19, Android 4.4 / KitKat.

Note: API 19 is the standard minimum SDK in Kodular (minSdkVersion = 19).

So adjust your guide accordingly.

Thanks @bodymindpower, I have updated my guide.

See here:

The third word: “not” !

My suggestion:

… , you can also replace this path with any other subdirectory, e.g.:

  • /storage/emulated/0/Download/ or
  • /storage/emulated/0/Download/DCIM/ or …

My suggestion:

Note : It is not possible to save image in external removable sd card in API 19, Android 4.4 / KitKat or higher.

Added, Thanks a lot

1 Like

nice extension…great work…

:rofl::rofl::rofl: It’s not a extension, I have used them in my guide.

Would be great if we can convert image componant to Base64 without using any path image.
With SurfaceView it’s possible to display image from Camera without having to save it on the disk, so from there i would love to get it as base64, all tha base64 extension require path.

The extension ComponentToImage is working very well in test mode with companion, but it is not working after exporting App.

Maybe you are using blocks incorrectly, extension is working fine, try to use blocks as shown above.

Thanks, its working now. The issue was of Grant permission to write to external storage,

How can I use this image without asking for permission?

I think this is not possible as to save image in storage, app must have storage permission.

Can’t we store in ASD?? (I don’t understand much about it)

3 posts were split to a new topic: Is it possible to save the screenshot to App-specific directory?