Hi all,
I load an image from disk via FileChooser in an ImageView in this way:
Later I save the image from ImageView to the disk in this way:
The dimension of the original file is 1,45MB.
The dimension of the saved file is 10,6MB.
Why the file gets so big?
Christian
I load an image from disk via FileChooser in an ImageView in this way:
B4X:
Dim fc As FileChooser
fc.Initialize
fc.Title="Select the work image"
fc.InitialDirectory = FileSystem.FindUserDocumentsFolder
fc.SetExtensionFilter("Image", Array As String("*.jpg","*.png","*.bmp"))
Dim fileChosen As String = fc.ShowOpen(ParentForm)
If fileChosen.Length = 0 Then
Return
End If
Dim filePath As String = File.GetFileParent(fileChosen)
Dim fileName As String = File.GetName(fileChosen)
Dim newImage As Image
newImage.Initialize(filePath, fileName)
imgWork.SetImage(newImage)
Later I save the image from ImageView to the disk in this way:
B4X:
Dim editImage As Image = imgWork.GetImage
If editImage.IsInitialized Then
File.WriteBytes(filesPath, fileName, ImageUtils.ImageToBytes(editImage))
End If
Public Sub ImageToBytes(img As Image) As Byte()
Dim out As OutputStream
out.InitializeToBytesArray(0)
img.WriteToStream(out)
out.Close
Return out.ToBytesArray
End Sub
The dimension of the original file is 1,45MB.
The dimension of the saved file is 10,6MB.
Why the file gets so big?
Christian