Android Question Saving part of a picture / butmap: Blurred results

Similar threads

B4A Library [B4X] BitmapCreator Effects
B4A Code Snippet [B4X] [BitmapCreator] Blur Image
B4A Library [B4X] [BitmapCreator] BlurredDialog
Share My Creation Blur Effect Demo
B4A Tutorial SQL tutorial

grafsoft

Well-Known Member
Licensed User
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

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
 
Top