Help needed

walterf25

Expert
Licensed User
Longtime User
hello everyone, i'm very close to finishing my app, i'm stuck trying to reconstruct an image from a byte array, i'm receiving the byte array from an application written in visual studio 2008, everything else works just fine.
i have this code given to me by Poseidon who has been kind enough to share it with me but i get an error saying "error loading bitmap"
I will really appreciate it if someone can help me figure this out

B4X:
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(msg1, 0, msg1.Length)  'msg1 contains the data received from the server.
Dim bitmap1 As Bitmap
bitmap1.Initialize2(InputStream1)   
imageview2.Bitmap = bitmap1

thanks everyone,
Walter
 

Bill Norris

Active Member
Licensed User
Longtime User
RE:

Walter --
I don't know if this will help but I had a similar problem when downloading image files from server. Try inserting the following line

B4X:
inputstream1.close

after your line

B4X:
InputStream1.InitializeFromBytesArray(msg1, 0, msg1.Length)  'msg1 contains the data received from the server.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Please Help

Closing the input stream will not help. The problem is probably in the data itself.

Hi Erel, but when i run the file through an online service to decode the data it works just fine, you mentioned in my other post that the file begins with the UTF8 BOM Marking, if this is the case why does the online service processes the file just fine and b4a doesn't.

Free Usenet Tools - Online Base64 Encoder and Decoder. Usenet newsgroups binaries.
this is the website i use to decode the text file, when i decode the file, i can see the image just fine.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…