iOS Question Compress image not working

Discussion in 'iOS Questions' started by falbertini, Feb 20, 2015.

  1. falbertini

    falbertini Member Licensed User

    Hello,
    in my app I need to compress captured photo..
    I tried using this routine (on my Iphone 4S), but the size is the same and the saved file is not a jpg. It seems like this routine is not working:
    Code:
    Dim out As OutputStream = File.OpenOutput(Dir, Filename, False)
    Image.WriteToStream(out, 70"JPEG")
    out.Close
    How can I reduce the size of an image in B4i?
    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    How are you checking the format and size?
     
  3. falbertini

    falbertini Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    I tested it with this code (and a different image):
    Code:
    Dim origBitmap As Bitmap = LoadBitmap(File.DirAssets, "IMG_0995.JPG")
    Log(File.Size(File.DirAssets, "IMG_0995.JPG"))
    Dim out As OutputStream = File.OpenOutput(File.DirTemp, "1.jpg"False)
    origBitmap.WriteToStream(out, 
    20"JPEG")
    out.Close
    Log(File.Size(File.DirTemp, "1.jpg"))
    The image was compressed from 170k to 57k.
     
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