Hi,
My problem is
I'm creating an image file from canvas then i want to resize it because canvas size is very large.
But while trying to manage that i am getting an error about FileNotFoundException.
Maybe i am calling ResizeBitmap sub before creating image file
It is also OK for me to resize image file before saving it... Is it possible?
Thank you...
My problem is
I'm creating an image file from canvas then i want to resize it because canvas size is very large.
But while trying to manage that i am getting an error about FileNotFoundException.
Maybe i am calling ResizeBitmap sub before creating image file
B4X:
Sub btn_save_Click
Dim Out As OutputStream
Bitmap1.Initialize3(Canvas1.Bitmap)
fileName = DateTime.Now & ".PNG"
Out = File.OpenOutput(File.DirRootExternal & "/fingerNotes",fileName, False)
Bitmap1.WriteToStream(out, 10, "PNG")
Out.Close
ResizeBitmap(LoadBitmap(File.DirAssets,fileName), 100, 20)
End Sub
Sub ResizeBitmap(original As Bitmap, width As Int, height As Int) As Bitmap
Dim new As Bitmap
new.InitializeMutable(width, height)
Dim c As Canvas
c.Initialize2(new)
Dim destRect As Rect
destRect.Initialize(0, 0, width, height)
c.DrawBitmap(original, Null, destRect)
Return new
End Sub
It is also OK for me to resize image file before saving it... Is it possible?
Thank you...