Save image to file

macerau

Member
Licensed User
Longtime User
Hi Erel,
From what I read a lot in the documentation and realized all looking for an answer that I'm sure is very simple.
a routine that writes image to a file from ImageView.
I have no doubts that this can help many users
Please see if you can make this routine

B4X:
....
SavePhoto (Photo.bitmap,"MyPhoto.png")

....


Sub SavePhoto (Pt As Bitmap,NewFile As String)
?
?
End Sub
 
Last edited by a moderator:

macerau

Member
Licensed User
Longtime User
B4X:
....
SavePhoto (Photo.bitmap,"MyPhoto.png")

....


Sub SavePhoto (Pt As Bitmap,NewFile As String)
 Dim Out As OutputStream 
 Out = File.OpenOutput(File.DirRootExternal, NewFile, False)
 Pt.WriteToStream(out, 100, "PNG") 
 Out.Close
End Sub

Very Well This work!
had tried this routine several times, and it did not work because I was used File.DirAssets.
It is not possible to write in File.DirAssets?

My satisfaction of both the program and the support is 10! Keep it up!
 

kanaida

Active Member
Licensed User
Longtime User
File.dir assets Is a pretend folder that really just unzips and let's you read files you include. file.dirinternal is always there' its phone memory. Direxternal may or may not exist. Eg, sdcard.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…