Problem to read an image

sioconcept

Active Member
Licensed User
Longtime User
Hi,

When i edit my image (mode text), it begin by "ÿØÿà--JFIF", but when i read the file, i have "ÿýÿýÿýÿý--JFIF" in ImageBuffer (String) under B4A.

B4X:
ImageBuffer = File.GetText(File.DirRootExternal & "/" & Loader.FolderName, "image.jpg")

:BangHead: What's the problem ?
 

sioconcept

Active Member
Licensed User
Longtime User
[Resolved]

I've found a solution.

B4X:
   Dim raf As RandomAccessFile
   Dim SignString As StringBuilder
   Dim Su As StringUtils
   Dim Encoded As String
   
   SignString.Initialize()

   raf.Initialize(File.DirRootExternal & "/" & Loader.FolderName, "image.jpg", True)
   For i = 0 To raf.Size - 1
      SignString.Append(Chr(raf.ReadUnsignedByte(i)))
   Next
   Encoded = Su.EncodeBase64(SignString.ToString.GetBytes("UTF8"))
   Log(Encoded)
 
Upvote 0
Top