Page 1 of 1
Image Cropping
Posted: 28 Mar 2020 14:51
by yogi108
Hi there,
I want to crop an image and save the result.
Just found out about
start action
Code: Select all
Action:
android.intent.action.VIEW
Data URI
file:///storage/.....
MIME Type
image/*
Explicite Component
com.android.gallery3d
class name
com.huawei.gallery.app.CropImageActivity
That's pretty cool, but it doesn't save the cropped area, only showing the area and you can play around the size.
Anyway, if I use that it is HUAWEI, even if I get it somehow to work it is not compatible with others.
Any idea?
Regards
Fritz
Re: Image Cropping
Posted: 28 Mar 2020 17:25
by Desmanto
You don't need external app to do this. Automagic has action modify image. Use action init variable image file first, you can retrieve the path using pick file from your previous thread. Init the image, do modify image - crop to selection. The save the image again as file, then share it using Start Activity (if needed).
Re: Image Cropping
Posted: 28 Mar 2020 17:52
by yogi108
Hi Desmanto,
Thanks for your input.
Doing like you described there is the need to know the size of cropping.
I want a file to be shown, interactive move the points of
an rectangle and crop it. Is this really possible with AM
on board action? Did I miss something?
Thanks a lot
Regards
Fritz
Re: Image Cropping
Posted: 02 Apr 2020 05:51
by yogi108
Hi,
I could still not find a way to crop an image visual in AM.
If I could get 4 points visual I could crop it with AM.
any hints?
Regards
Fritz
Re: Image Cropping
Posted: 02 Apr 2020 06:17
by Desmanto
Not yet, Automagic doesn't have interactive cropping/resizing. It is for automation, so I don't think it will implement it. You should share to external app then, cropped there. I use picsay, but you can use other app too.
There is a way though to do it from Automagic alone. But the cropped area won't have exact pixel accuracy. Use Widget to show the image almost full screen. Let say the picture is 3000x4000. Then after the show widget action, use Show Control UI Gesture Recorder. This will show you the record screen. Draw a diagonal line from the top left to the bottom right of the picture. OK, then close the gesture recorder. The flow continue on to retrieve the coordinate from the recorded gesture. Calculate the top left and bottom right coordinate. Scale the pixel percentage to the screen resolution and get the exact x,y for the image resolution. Then calculate the width and height based on the bottom right coordinate. Load the image and crop based on these data, save it again.
There are also way you can predefined x,y to crop/scale to certain size and see the approximate result semi-realtime, by overlaying additional rectangle on the widget.
Seems too troublesome and might not be accurate (if you need accuracy). You better use 3rd party app to do it, maybe "resize me".
Re: Image Cropping
Posted: 02 Apr 2020 08:01
by yogi108
Desmanto wrote: ↑02 Apr 2020 06:17
Not yet, Automagic doesn't have interactive cropping/resizing. It is for automation, so I don't think it will implement it. You should share to external app then, cropped there. I use picsay, but you can use other app too.
There is a way though to do it from Automagic alone. But the cropped area won't have exact pixel accuracy. Use Widget to show the image almost full screen. Let say the picture is 3000x4000. Then after the show widget action, use Show Control UI Gesture Recorder. This will show you the record screen. Draw a diagonal line from the top left to the bottom right of the picture. OK, then close the gesture recorder. The flow continue on to retrieve the coordinate from the recorded gesture. Calculate the top left and bottom right coordinate. Scale the pixel percentage to the screen resolution and get the exact x,y for the image resolution. Then calculate the width and height based on the bottom right coordinate. Load the image and crop based on these data, save it again.
There are also way you can predefined x,y to crop/scale to certain size and see the approximate result semi-realtime, by overlaying additional rectangle on the widget.
Seems too troublesome and might not be accurate (if you need accuracy). You better use 3rd party app to do it, maybe "resize me".
Hi Desmanto,
I like cool ideas, it seems this solution needs much attention, maybe I'll give it a try later.
Just found out Resize me pro they just offer it for free THIS day, if anyone looks out for it.
Beside this theme is there any way to find out when starting an intent which extras there are to use
and which variables getting back? Of course it differs from app to app...
Using already "catch intent" if sharing to see what kind of data the app provides, but this is the other side...
Thanks a lot,
Regards
Fritz
Re: Image Cropping
Posted: 02 Apr 2020 10:17
by BoBo
Thx for the hint regarding (the momentarily free of charge)
Resize Me Pro app:
https://play.google.com/store/apps/deta ... size&hl=en
@ all
are there Android Apps out there which provide "command line" accessibility of its core functionalities ??
Re: Image Cropping
Posted: 03 Apr 2020 02:06
by Desmanto
@yogi108 : I am trying to proof my concept using widget alone, need some time. Resize me pro for free is just pure coincidence
You need to enable edit image from other app in the setting, in order to to crop manually after opening from Automagic.
Finding the "extra" passed is one of the challenge. I usually use intent intercept (can be downloaded from F-Droid, if you can't find it in playstore), if the app have the export/share intent or receive it. But if the activity is started background, you can take a peek of its action using logcat. Which I have done using my logcat flow, filter for ActivityManager. However, we still can't see the extra, which I am still trying to find the way. So far, unless the dev provide the documentation for it, it is quite difficult to know the detail. You can decompile the apk, but it is very difficult to search for it.
@BoBo : Most don't. If they open up, usually thru broadcast or activity, not from command line. Have to ask the dev for it. Usually they will provide a good documentation if they have decided to open up their function.
Re: Image Cropping
Posted: 03 Apr 2020 04:46
by yogi108
Desmanto wrote: ↑03 Apr 2020 02:06
@yogi108 : I am trying to proof my concept using widget alone, need some time. Resize me pro for free is just pure coincidence
You need to enable edit image from other app in the setting, in order to to crop manually after opening from Automagic.
Finding the "extra" passed is one of the challenge. I usually use intent intercept (can be downloaded from F-Droid, if you can't find it in playstore), if the app have the export/share intent or receive it. But if the activity is started background, you can take a peek of its action using logcat. Which I have done using my logcat flow, filter for ActivityManager. However, we still can't see the extra, which I am still trying to find the way. So far, unless the dev provide the documentation for it, it is quite difficult to know the detail. You can decompile the apk, but it is very difficult to search for it.
@BoBo : Most don't. If they open up, usually thru broadcast or activity, not from command line. Have to ask the dev for it. Usually they will provide a good documentation if they have decided to open up their function.
Found the setting and it works, at the moment this is the simplest way for me for cropping and I will use it in the flow next time.
Regarding the intent it should be a simple way - you know if you look at the source a few month later, even if you give some info and documentation
you need some time to come again to the point ....
Thanks again
Regards
Fritz