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

Discussion in 'Android Questions' started by grafsoft, Feb 22, 2015.

  1. grafsoft

    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

    Code:
    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(
    00, 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What is the output of Log(Bitmap1.Width)?
     
  3. grafsoft

    grafsoft Well-Known Member Licensed User

    2592, height is 1944, as expected
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    grafsoft likes this.
  5. grafsoft

    grafsoft Well-Known Member Licensed User

    Thank you, this works better! But slower :( Well I cannot have everything ...
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice