Murphy Mac - Screencasts and Tutorials » Posts in 'Automator' category

iPhone Photo Rotation – Broken in Lion

WordPress database error: [Table 'thelamar_wrdp2.wp_post2cat' doesn't exist]
SELECT post_date, ID, post_title, cat_name, cat_ID FROM wp_posts, wp_post2cat, wp_categories WHERE wp_posts.ID = wp_post2cat.post_id AND wp_categories.cat_ID = 38 AND post_status = 'publish' AND post_type != 'page' AND post_date < NOW() ORDER BY post_title DESC

I had a solution, but now it’s broken. Before we get into that let’s review what we’re talking about.

If you email portrait (vertically) – oriented photos from your iPhone your recipient is likely to view them sideways, especially if they open them using a browser-based mail service like Gmail.

The solution I was actually using: Email the files to myself first. My Mac would receive the photos and run an AppleScript triggered by the email subject. The script rotated the files, stripped out the exif tag that caused the problem, and mailed them back to me. I could then use that copy for sending to other people. It was relatively painless as I could email the photo right from the Camera app which kept the number of steps reasonable.

But a couple things aren’t working with Lion. The part of my AppleScript that pulls the attachments out and saves them to a folder in the Finder isn’t working. Others have the same problem. Further, the Automator action that sent the email back out isn’t working either. I’m not alone on that one either.

So, I looked at alternate solutions. Like uploading to Dropbox. Dropbox uploads a full res version of your photo. So I created a folder action script that handles the rotating and exif tweaking as soon as my Mac sees the file. That works fine. The problem is that the Dropbox app on my iPhone doesn’t download the full res version, it pulls down a version I consider too small.

I didn’t give up right away. The iOS Safari Dropbox DOES open a nice big version of the photo. From there I can save the photo to my camera roll and email it out. Recipients get a correctly oriented version of the photo, big enough to see.

So now the problem is the number of steps and apps involved. I could use something like Instagram but sometimes I just want to send a photo in an email, straight-up.

I don’t understand why Apple has made this an issue. iOS used to rotate a different way. Their own browser on the Mac isn’t going to display the photo correctly because of the way they’re handling the rotation, with a tag. Why browsers can’t read the tag – I don’t know.

Anyway, I’ve got a solution for when I need it, but I don’t see myself using it much. Too many steps.

11/2011 Update:  I have this working again.  My Automator workflow fails at the step where it sends the email.  So I’ve updated the AppleScript with a command to send it.  I’ll post the updated script shortly.

| Permalink

Auto Mail Redux Part II The Revenge

WordPress database error: [Table 'thelamar_wrdp2.wp_post2cat' doesn't exist]
SELECT post_date, ID, post_title, cat_name, cat_ID FROM wp_posts, wp_post2cat, wp_categories WHERE wp_posts.ID = wp_post2cat.post_id AND wp_categories.cat_ID = 38 AND post_status = 'publish' AND post_type != 'page' AND post_date < NOW() ORDER BY post_title DESC

mailerA long long time ago Murphy showed you how to mail attachments with one click and drag of a file. No addressing, no clicking send.  Drag the file to a Finder folder and it was emailed to a pre-set address.  I used to use it for backing up files into a Gmail account.   You might find it useful for services like Evernote and Flickr as well.

Now we’ll show you how to do it in Automator, with enhancements.  First, the file name(s) of the attachments get added to your email’s subject line automatically.  Second, the sent files are placed in a Finder folder of sent items.  Murphy provided an Automator solution for this task before, but the email subject feature and the filing are new features.

Here’s a screencast that shows how it works.    When you want to send a file simply drag it to the folder and it’s sent.  No additional clicks.  You might create different versions of the Automator application.  For example, one might mail to a Flickr account and another might be used for sending a photo to four grandparents at once.

Feel free to suggest enhancements to the Automator workflow in the comments.  There’s a third party Automator action that can easily get file names without the full path name if that’s what you prefer.

You can see all the actions in the Automator workflow here.

Screencast | Permalink

iPhone Photo Rotation – Part Two

WordPress database error: [Table 'thelamar_wrdp2.wp_post2cat' doesn't exist]
SELECT post_date, ID, post_title, cat_name, cat_ID FROM wp_posts, wp_post2cat, wp_categories WHERE wp_posts.ID = wp_post2cat.post_id AND wp_categories.cat_ID = 38 AND post_status = 'publish' AND post_type != 'page' AND post_date < NOW() ORDER BY post_title DESC

beautifulMurphy already posted about issues with mailing vertically-oriented photos from your ios4 iPhone:  Chances are your recipient sees the photo rotated 90 degrees to the left.  Web browsers – Safari included – don’t know how to read the exif orientation tag included with the jpg file.

My previous solution was to use an alternate camera app.  But I’ve got another approach that requires a Mac running Mail.

When I take a photo with my iPhone – in portrait orientation – I simply email it to myself.  My Mac is configured to watch for email with a particular subject and then automatically grab the attachment, strip the exif rotation information, and rotate the photo without using a tag.  Then my Mac mails the photo back to me.

Here’s the setup:

In Finder

In your home folder create a folder called lab with subfolders in and out.  Like this:

/Users/murphy/lab/in

/Users/murphy/lab/out

AppleScript

Download my AppleScript.  Edit the AppleScript and change all occurrences of ‘murphy” to the name of your home folder.  There are notes in the script to help you.

Automator

WorkflowCreate an Automator workflow.  You’ll need to add 4 actions in the same order they’re listed below.

  • Mail: New Mail Message
  • Finder: Get Specified Finder Items
  • Mail: Add Attachments to Front Message
  • Mail: Send Outgoing Messages

Only the first two Automator elements need further configuration.  The first one defines the address your altered photo will be emailed to.  You might add a subject as well.

Then specify this file path in the Finder element:

/Users/murphy/lab/out/outbound.jpg

Make sure you replace “murphy” with your home folder name.  The path points to the photo Automator will mail back to you. Save as a workflow. The AppleScript expects the workflow to be in a folder called _applescripts in your Documents folder. Edit the AppleScript if your workflow will be stored somewhere else.

Mail

WorkflowIn Mail you need a rule to kick off the AppleScript when a message arrives meeting certain criteria.  My rule looks like this screenshot.  The script runs when an email arrives with the subject “rotate”.  You might select a different word or phrase.  Make sure you set the script path to the location where you saved your AppleScript. More on Mail rules.

jhead

The AppleScript relies on a command line utility called jhead to strip the exif rotation tag, which I found in this TUAW post.  My script expects jhead to be in the /Users/murphy/lab/in folder.  After downloading jhead you’ll need to make it executable.  In the Terminal:

chmod +x path/to/jhead

In my case I entered chmod +x /Users/murphy/lab/in/jhead

That’s about it.  My script pulls the photo from the email, rotates it, strips the exif rotation information, copies it to another folder, and kicks off an Automator workflow to mail the photo back to me.

When I receive the altered photo on my iPhone I can simply forward it to someone.  If they view it in web Gmail they’ll see the photo inline-style within the email.  I prefer to save the photo to my camera roll and send it from there.  That way I’m prompted to select a size and recipients using web-based gmail get a thumbnail with a choice to view or download.

Notes

You might want to place jhead somewhere other than where I did.  If you move it you’ll need to edit the AppleScript.

Mail needs to be running on your Mac for this to work.

I used an Automator workflow to send the return email.  You can do it in AppleScript if you prefer, but I’ve had mixed results down that road.  Decided to try Automator.

You could use Automator to extract the attachment.  I’d already written a script to extract an attachment from Mail so it seemed like the way to go.

You could alter the AppleScript so everything happens in one folder.  I used two folders only to help me with troubleshooting the script the first time through.

Don’t forget to make jhead executable.

Dropbox Alternative

Here’s another alternate solution:  Dropbox

You could upload your images to Dropbox from your iPhone – then mark them as a favorite.  From there you copy the image to the clipboard to paste into a mail or save it down to your camera roll.   They won’t be full-size though.  And if you paste and mail it’ll be sent as a png.  But the orientation will be correct.  If you simply upload and send the link the orientation will be wrong.

OR

You could use something like my script above to place a full-size copy of your file in your Mac Dropbox.  Then you can access the photo from the Dropbox app on your iPhone.  You’ll still need to copy and paste or save it to the roll to get the rotation right.

perfect Yeah – it’s a lot to set up and you need a Mac running to use it. I can wake my Mac up from my phone so that’s not a big deal. And I find mail-based workarounds like this convenient to use. Still – maybe Apple should switch back to the old way until the browsers catch up.

Script Download | Permalink

New and Improved: Finder Emailing

WordPress database error: [Table 'thelamar_wrdp2.wp_post2cat' doesn't exist]
SELECT post_date, ID, post_title, cat_name, cat_ID FROM wp_posts, wp_post2cat, wp_categories WHERE wp_posts.ID = wp_post2cat.post_id AND wp_categories.cat_ID = 38 AND post_status = 'publish' AND post_type != 'page' AND post_date < NOW() ORDER BY post_title DESC

Murphy posted about emailing from Finder a while back. This new screencast was entered in the Macinstruct tutorial contest, winner to be announced next week.

Finder MailerJust drag a file to a folder and it flies off to a pre-determined email address. Optionally, have the action prompt you for a subject so you can find it later.

Murphy finds this technique extremely useful for quickly backing up important files to a dummy Gmail account – especially with the new 20MB attachment size. You have files you can’t bring yourself to delete? Drag them to the folder and they’re on their way to a mail server, just in case you want them later. No addressing, no need to click send. It’s just sent. Murphy knows you can drag files to the Mail icon in the Dock. This is more direct – no extra clicks!

If you’ve got multiple assistants you send files to all the time you could create a folder for each. Dragging a file to their folder is like dragging it to their inbox.

The new screencast details both a Folder Action and an Automator solution. They achieve the same thing in terms of sending. The difference is that the Automator method leaves the file in its original location on your disk, which might be more convenient. But the Folder Action method can be utilized from an SSH session. That opens up a lot of possibilities and offers extra convenience.

The Automator solution comes from a post on TUAW that was inspired by a post on MacOSXHints that was submitted by Murphy. How’s that for a chain of events?

Visit the previous post to download the AppleScripts used in the screencast.

Watch Now | Permalink

iPhoto Review Tool : Automator

WordPress database error: [Table 'thelamar_wrdp2.wp_post2cat' doesn't exist]
SELECT post_date, ID, post_title, cat_name, cat_ID FROM wp_posts, wp_post2cat, wp_categories WHERE wp_posts.ID = wp_post2cat.post_id AND wp_categories.cat_ID = 38 AND post_status = 'publish' AND post_type != 'page' AND post_date < NOW() ORDER BY post_title DESC

iPhoto has a lot of stuff packed inside. Book makers, slideshows, greeting cards, special effects – it’s easy to get distracted when you’re trying to clean house and delete some photos. That’s where Automator comes in.

Just add three actions to a workflow – you’ll find them all under iPhoto in Automator:

  1. Ask for Photos
  2. Review Photos
  3. New iPhoto Album

You’ll probably want the last one to prompt you for a name, so check the option to “Show Action When Run”.

Save the workflow as an application. When you run it you’ll see the same mini-browser we saw in a post last week. But you’ll also get a handy panel asking you to approve or reject each image. Make your choices, and an album will fill with your rejects. You could reverse the process and have Automator do something with the Approved images, like adding them to a Finder folder.

Confused? See it all in a screencast.

Once you’ve isolated your rejects in an album you can remove the files from your disk. Here’s more information on deleting from iPhoto.

Watch Now | Permalink