iOS Question Strange thing when converting Bitmap to Bytes

narek adonts

Well-Known Member
Licensed User
Longtime User
Hi,

I am using this Sub to convert a bitmap to bytes.

B4X:
Sub BitmapToBytes(Image As Bitmap) As Byte()
Dim out As OutputStream
Dim bb() As Byte
out.InitializeToBytesArray(0)
Image.WriteToStream(out,100,"JPEG")
out.Close
bb=out.ToBytesArray
Log(bb.Length)
Return bb

End Sub

The strange thing is for a Image of 1MB after converting to bytes it become 3.4MB

Can someone check it please and advise a solution. Thank you.
 

narek adonts

Well-Known Member
Licensed User
Longtime User
the problem is that I want to use the same image size as it is.

When I am trying to send the image by Mail app it says that actual size is 1MB when trying to convert the same image to bytes with UIImageJPEGRepresentation the Bytes length is more then 3MB.
 
Upvote 0
Top