Android Question How to Crop Image using Internal crop

Discussion in 'Android Questions' started by Imam, Feb 5, 2015.

  1. Imam

    Imam Member Licensed User

    how to crop the image if the file : // to the image . not the user who choose it manually

    the code below to select manually from the user

    Code:
    Dim i As Intent
        i.Initialize(i.ACTION_PICK, 
    "")
        i.SetType(
    "image/*")
        i.PutExtra(
    "crop""false")
        i.PutExtra(
    "output", ParseUri("file://" & File.Combine(Directory, PictureName)))
        i.PutExtra(
    "aspectX", aspectRatio.Width)
        i.PutExtra(
    "aspectY", aspectRatio.Height)
        i.PutExtra(
    "outputX", aspectRatio.Width)
        i.PutExtra(
    "outputY", aspectRatio.Height)
        
    StartActivity(i)
    thanks
     
  2. Imam

    Imam Member Licensed User

    i try this...
    Code:
    Sub cropPicture(Directory As String, PictureName As String,  PictureName2 As String)
        
    Dim i As Intent
        i.Initialize(
    "com.android.camera.action.CROP","")
        i.SetType(
    "image/*")
        i.SetComponent(ParseUri(
    "file://" & File.Combine(Directory, PictureName)))
        i.PutExtra(
    "crop""true")
        i.PutExtra(
    "aspectX"1)
        i.PutExtra(
    "aspectY"1)
        i.PutExtra(
    "output", ParseUri("file://" & File.Combine(Directory, PictureName2)))
        
    StartActivity(i)
    End Sub
    I can not use "intent.setData(selectImageUri);" from this
    http://stackoverflow.com/questions/...ing-com-android-camera-action-crop-on-android

    i try "i.SetComponent(ParseUri("file://" & File.Combine(Directory, PictureName)))"

    help me @Erel
     

    Attached Files:

    • ss.png
      ss.png
      File size:
      58.4 KB
      Views:
      137
  3. Imam

    Imam Member Licensed User

    thanks.. solution is

    Code:
    Sub cropPicture(Directory As String, PictureName As String,  PictureName2 As String)
        
    Dim i As Intent
        i.Initialize(
    "com.android.camera.action.CROP", ParseUri("file://" & File.Combine(Directory, PictureName)))
        i.SetType(
    "image/*")
        i.PutExtra(
    "crop""true")
        i.PutExtra(
    "aspectX"1)
        i.PutExtra(
    "aspectY"1)
        i.PutExtra(
    "output", ParseUri("file://" & File.Combine(Directory, PictureName2)))
        
    StartActivity(i)
    End Sub
     
    Kwame Twum, mostafarkn and DonManfred like this.
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