Example Workflow: Downloading Linked Website Images


Whether they're photos from your cousin's wedding, your co-worker's trip to Yosemite, or from the Hubble telescope, it's common practice for organizations and individuals to post images on webpages for others to view and download. Automator can make it easy to locate and download images from webpages. This example will show you how to construct a re-usable workflow that locates and downloads images linked from webpages and adds them to your iPhoto library.

Step 1: View the Website

The illustration below depicts a standard webpage design that uses small image thumbnails to link to larger versions of the images. When a thumbnail is clicked, the larger image targeted by the linked thumbnail is displayed in the browser window.

Click the illustration below to open the webpage in a new browser window. Click the thumbnails in the newly opened browser window to examine how the links are designed.

Step 2: Build the Workflow

Launch the Automator application or create a new empty workflow, by choose the New menu item in the File menu, if the application is already open.

Next, we'll locate and add the actions necessary to scan the currently displayed webpage and download the larger linked images. Since the webpage is displayed using the Safari application, click on the Safari actions library in the Library list on the left side of the Automator window to display its list of available actions.

The actions in the Action list view are always grouped with the most relevant actions at the top of the list. An action's relevancy is based on what actions are already added to the workflow and is indicated by the length of bars to the right of the action name.

Since the workflow currently has no actions, the most relevant actions are those that often are used to begin a workflow. Click the Get Current Webpage from Safari action in the action list.

As you can see from the information displayed in the Description field at the bottom left of the Automator window, this action will get the URL of the frontmost Safari browser window and pass it to the next action in the workflow.

Add the action to the beginning of the workflow by dragging it from the Action list view into the workflow area and releasing the mouse. Its Action View will be displayed.

The next step in the workflow is to scan the passed webpage to locate the larger images linked from the smaller thumbnails. Add the Get Image URLs from Webpage action to the workflow by dragging it from the Action list to the workflow area. The two action will connect to indicate that the data from the first action will pass to the second.

Click on the popup menu in the Action View of the newly added action and select the option to get the URLs of the larger images that are linked from the smaller thumbnails on the main webpage.

The next step in the workflow is to download the images located by the last action. From the Safari action list, drag the Download URLs action to the end of the workflow. Set the destination folder from the popup menu in its Action View to the Pictures folder.

The final step in the workflow is to add the downloaded image files to your iPhoto collection. From the Library list, click the iPhoto library and drag the Import Photos into iPhoto action to the end of the workflow.

Select the New Album radio button in the Action View and enter "Baseball" as the name for the new album in the corresponding text field. And since iPhoto automatically copies any image added to its library, select the checkbox to Delete the Source Images After Importing Them.

The workflow is complete and ready to be executed.

Step 3: Run the Workflow

Make sure the browser window containing the first page of image thumbnails is selected and infront of any other browser windows. Switch to Automator and click the Run button at the top right of the Automator window.

Each action will execute in sequence until completed and a new album has been created in iPhoto containing the downloaded images.

Step 4: Save and Re-use the Workflow

One of the most powerful features of Automator is its ability to save workflows to enable them to be used again and again. Before saving this example, change the parameters of the last action to make it able to be used in a variety of situations.

Select the radio button to Choose Album, leave the iPhoto Library as the target album. Click the Options disclosure triangle to reveal the options panel for this action. Click the Show Action When Run checkbox to have this action view displayed when the action is executed.

Now you're ready to save the workflow. Choose Save As Plug-in... from the Automator File menu and in the forthcoming sheet enter "Add Linked Images to iPhoto" as the workflow name and save it as a plug-in for the Script Menu.

Once the workflow has been saved, the system Script Menu will be activated if it is not already active. To make access to the script only available while in Safari, you'll move the workflow file from the user Script folder to the Safari script folder.

While in Automator, choose Open User Scripts Folder from the Script Menu. The Script folder within your Library folder will open on the desktop.

Switch to Safari and then choose Open Safari Scripts Folder from the Script Menu. The folder containing Safari script will open on the desktop.

Drag the saved workflow file from the Scripts folder to the Safari scripts folder and close the two Finder windows when done.

Now you're ready to download the remaining images from the website.

Quit Automator and then switch to Safari. Navigate to the second page of images in the browser window. Select Add Linked Images to iPhoto from the Script Menu to start the workflow.

Once the workflow has started, status and progress controls will be displayed in the main menu bar. The red button next to the spinning progress indicator can be used to halt the workflow if need be.

After the images have been located and downloaded to the Pictures folder, the action view for the import action will be displayed in the center of the screen. Choose the existing album named "Baseball" from the popup list and click the Continue button.

After the import has completed, switch back to Safari and navigate to the third page of the website. Run the workflow again. WHen the workflow is done, your iPhoto library will now contain all the images from the website.

This saved workflow can be used with many different websites to enable you to retrieve images with very little effort.