Sunday, March 26, 2017

How to Automatically Enhance your Photos in Snapseed

I suck at photo editing (and photography in general) and I'm not ashamed to admit it. I haven't bothered learning how to use manual camera controls or edit raw images like some of my colleagues have. Like most people, I use the default features of my camera, with all options set to automatic, to let the software decide what the best white balance, focus, brightness, etc. should be set to.

On occasion, if my initial photograph didn't come out as I had hoped, I would run it through Snapseed's automatic tuning feature. But if I want to perform this action on a multitude of photos (say, >50), it would quickly become a hassle because I would have to open, adjust, then save every individual photo manually in Snapseed. Given my background in Android automation, I thought to myself: why don't I just automate this process? And so I did. Meet the Auto-Snapseed Tasker script.


Automatically Enhance your Photos with Auto-Snapseed for Tasker

Requirements:

You will obviously need Snapseed for this project, as that is the application we will be using to fine tune our photographs. Tasker is needed because this automation application is what we will use to interface with the two plug-ins: AutoInput and AutoShare. AutoShare is necessary to create a new item in Android's share menu so you can quickly enhance photos as well as sharing those photos to be opened in Snapseed. AutoInput then automates the taps necessary to enhance the photo automatically.

Once you've got these apps installed, we have to set a few things up. First, you'll need to grant AutoInput the ability to start its Accessibility Service, which the app will nag you to do once you open it up. Next, we'll need to create a new AutoShare command so that we will have a menu option to select AutoShare when we open the image share dialog. Open up AutoShare and scroll down to "AutoShare Settings" and make sure that "AutoShare Command" is checked. Then, go up and select "Manage Commands." Hit the + icon to add a new command and name it "Auto-Snapseed." Select any icon that you wish, but I recommend using the Snapseed icon to make it clear what this does.

Now we're ready to start making our script in Tasker. Open up Tasker and press + at the bottom right to create a new Profile. Name it "Auto-Snapseed" and select the Event Context. Go to Plugin –> AutoShare –> AutoShare Command. Press the pencil icon to open up the configuration, then for the Command select the "Auto-Snapseed" command you made before.

Back out of the Profile config, and Tasker will ask you to create a new Task. You can opt to name the Task, but it isn't necessary. Hit the checkmark to open up the Task editing screen. I'll walk through step-by-step instructions on what you'll need to do, but for those of you who are already familiar with Tasker, you can expand the below toggle to see the script's description.

Auto-Snapseed Tasker Description

    Profile: Auto-Snapseed (208)  Event: AutoShare [ Configuration:Command: Auto-Snapseed  Sender: all  Subject: all  Text: all  File: all ]  Enter: Auto-Snapseed (207)  A1: For [ Variable:%image Items:%asfile() ]  A2: AutoShare [ Configuration:Package: com.niksoftware.snapseed  Class: com.google.android.apps.snapseed.EditActivity  App: AutoShare  Action: Share  MimeType: image/jpeg  File: %image Timeout (Seconds):10 ]  A3: AutoInput Action [ Configuration:Type: Text  Value: Add filter  Action : Click Timeout (Seconds):20 ]  A4: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]  A5: AutoInput Action [ Configuration:Type: Text  Value: Tune Image  Action : Click Timeout (Seconds):20 ]  A6: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]  A7: AutoInput Action [ Configuration:Type: Text  Value: Auto Adjust  Action : Click Timeout (Seconds):20 ]  A8: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]  A9: AutoInput Action [ Configuration:Type: Text  Value: Apply  Action : Click Timeout (Seconds):20 ]  A10: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]  A11: AutoInput Action [ Configuration:Type: Text  Value: DONE  Action : Click Timeout (Seconds):20 ]  A12: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]  A13: End For  

  1. Task –> For. Variable: %image. Items: %asfile(). This will loop the variable %image through however many images you are sharing through the share dialog.
  2. Plugin –> AutoShare –> AutoShare. Package: com.niksoftware.snapseed. Class: com.google.android.apps.snapseed.EditActivity. App: AutoShare. Action: Share. MimeType: image/jpeg. File: %image. This action will send the shared image, one by one, that is referenced by %image to Snapseed for editing.
  3. Plugin –> AutoInput –> Action. Press "Easy Setup" and then open your gallery app and select any image to share to Snapseed. Pull down the notification shade, expand the AutoInput notification, and press the "add" button. Now press the floating pencil icon button to allow AutoInput to record/capture this input. AutoShare will automatically open the Recent Apps menu and ask you to go back to Tasker. Do so and when you return you should see a pop-up asking you what value to select. Choose the "Add filter" text type and select the click action.
  4. Task –> Wait. Wait 1 second.
  5. Plugin –> AutoInput –> Action. Press "Easy Setup" again and go back to Snapseed. This time press the floating pencil icon BEFORE starting AutoInput's recording. You should see all of the image enhancements options Snapseed offers. NOW pull down the notification and press "add." Select the "tune image" option to let AutoInput record it. Return to Tasker and select the "Tune Image" text type and select the click action.
  6. Task –> Wait. Wait 1 second.
  7. Plugin –> AutoInput –> Action. Hopefully you're getting the picture now. We're advancing the manual image tuning process step by step and having AutoInput record our actions so we can play them back automatically. Go back to Snapseed and this time press the "tune image" option to bring up the brightness/saturation/etc. options. Pull down the AutoInput notification, select the "add" button, and now press the "auto (magic wand)" button in Snapseed to record that action. Return to Tasker and select the "Auto Adjust" text type and select the click action.
  8. Task –> Wait. Wait 1 second.
  9. Plugin –> AutoInput –> Action. Open Snapseed and pull down the notification shade and press "add." Now that the image is auto-adjusted, select the checkmark icon in the bottom right to let AutoInput record that. Return to Tasker and select the "Apply" text type and select the click action.
  10. Task –> Wait. Wait 1 second.
  11. Plugin –> AutoInput –> Action. Open Snapseed one final time, start the AutoInput recording, then press the "DONE" button in the top left corner to record this input. Return to Tasker and select the "DONE" text type and select the click action.
  12. Task –> Wait. Wait 3 seconds. We need this 3 second timer to ensure there's enough time for Snapseed to save the photo before moving on to the next one.
  13. Task –> End For. End the for loop!

That's it! The hassle here is setting up the for loop, which requires you to manually record the steps involved in applying Snapseed's auto image tuning feature. But once you've done it once, you won't have to manually do it ever again! And an added bonus is that you can now send 2, 3, or even dozens of photos to Snapseed through the share menu and it will automatically enhance each and every one of them! All you have to do is sit back and watch. Your edited photos will be found in the Snapseed folder on your internal storage.


Download and Import

As always, we are providing the Tasker script so you can quickly download and import it. Download the .prf.xml file from below and save it anywhere on your internal storage. Open up Tasker and disable Beginner Mode in Preferences. Then, go back to the main menu and long-press on the Profile tab up top. You should see an option to Import a profile. Select that and locate the XML file you downloaded.

Download the Auto-Snapseed Script

Once you do import this, make sure that you still go back and set up AutoInput and AutoShare as mentioned earlier. Otherwise, AutoShare won't show up in your share menu and AutoInput won't be able to send input taps on your phone!

Let me know if you like this project, and what kinds of automation you would like to see in a future tutorial below!



from xda-developers http://ift.tt/2n5IUjK
via IFTTT

No comments:

Post a Comment