Android Question How to Crop Image using Internal crop

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

B4X:
    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
 

Imam

Member
Licensed User
i try this...
B4X:
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
 

Attachments

Imam

Member
Licensed User
thanks.. solution is

B4X:
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
 
Top