Hi,
I am following an example on how to save only a part of an image (savepartbitmap by Erel).
I load an image 2592*1944 and want to save it 2592*1457, because I want to save only the part of a photo I can see in the finder.
It works, but the picture is very blurred. However, the size seems OK.
Thank you
Peter
I am following an example on how to save only a part of an image (savepartbitmap by Erel).
I load an image 2592*1944 and want to save it 2592*1457, because I want to save only the part of a photo I can see in the finder.
It works, but the picture is very blurred. However, the size seems OK.
Thank you
Peter
B4X:
Dim cvsImage As Canvas
Dim Bitmap1, Bitmap2, Bitmap3 As Bitmap
Dim RectSrc, RectDest As Rect
Bitmap1.Initialize(Main.outdir,Main.thepic)
' Bitmap2.InitializeMutable(96, 64)
' cvsImage.Initialize2(Bitmap2)
' RectSrc.Initialize(50, 50, 50 + 96, 50 + 64)
' RectDest.Initialize(0, 0, 96, 64)
Bitmap2.InitializeMutable(wi,he)
cvsImage.Initialize2(Bitmap2)
dim x as int = 0
dim y as int = 243
dim wi as int = 2592
dim he as int = 1457
RectSrc.Initialize(x,y,x+wi,y+he)
RectDest.Initialize(0, 0, wi,he)
cvsImage.DrawBitmap(Bitmap1, RectSrc, RectDest)
Dim Out As OutputStream
Out = File.OpenOutput(Main.outdir,Main.thepic, False)
' Bitmap2.WriteToStream(Out, Settings.jpgquality, "JPEG")
Bitmap2.WriteToStream(Out, 100, "JPEG")
Out.Close