{"id":2393,"date":"2012-12-29T17:57:41","date_gmt":"2012-12-29T17:57:41","guid":{"rendered":"http:\/\/www.bartbusschots.ie\/blog\/?p=2393"},"modified":"2014-08-05T20:19:00","modified_gmt":"2014-08-05T20:19:00","slug":"os-x-service-for-stripping-geotags-from-jpeg-images","status":"publish","type":"post","link":"https:\/\/www.bartbusschots.ie\/s\/2012\/12\/29\/os-x-service-for-stripping-geotags-from-jpeg-images\/","title":{"rendered":"OS X Service for Stripping Geotags from JPEG Images"},"content":{"rendered":"<p>Back in 2011 I wrote a <a href=\"http:\/\/www.bartbusschots.ie\/blog\/?p=1906\" target=\"_blank\">blog post explaining how to create an OS X Service for stripping keywords from image files<\/a>. In this post we&#8217;ll use the same technique to create a Service for stripping geotags from JPEG images.<\/p>\n<p>As with the keyword stripping service, there are two prerequisites for this action, one is required, one is optional. You absolutely MUST have install <a href=\"http:\/\/www.sno.phy.queensu.ca\/~phil\/exiftool\/install.html#OSX\" target=\"_blank\">EXIFTool<\/a> installed, and it would be good if you also had <a href=\"https:\/\/itunes.apple.com\/us\/app\/growl\/id467939042?mt=12&#038;ign-mpt=uo%3D4\" target=\"_blank\">Growl<\/a> installed, but it&#8217;s not essential.<\/p>\n<p><!--more--><\/p>\n<p>Start by opening Automator, and creating a new <code>Service<\/code> workflow.<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bartbusschots.ie\/blog\/wp-content\/uploads\/2012\/12\/Screen-Shot-2012-12-29-at-16.48.05.png\" alt=\"Create New Service Workflow in Automator\" style=\"border-width:0px;\" width=\"458\" height=\"490\" \/><\/p>\n<p>At the top of the new service workflow, alter the settings so the services takes as it&#8217;s input <code>Image Files<\/code> and that the service is available in just the Finder.<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bartbusschots.ie\/blog\/wp-content\/uploads\/2012\/12\/Screen-Shot-2012-12-29-at-16.51.15.png\" alt=\"Set The Service to Accept Image Files in Finder\" style=\"border-width:0px;\" width=\"490\" height=\"90\" \/><\/p>\n<p>Find the Run Shell Script action and drag and drop it into the workflow (you&#8217;ll find the action in the Utilities category, or by searching in the search bar). Change the <code>Shell<\/code> option at the top of the <code>Run Shell Script<\/code> action to <code>\/usr\/bin\/perl<\/code>, and the <code>Pass input<\/code> option to <code>as arguments<\/code>.<\/p>\n<p>To do the actual work we will add the following perl code into the action:<\/p>\n<pre class=\"brush: perl; title: ; notranslate\" title=\"\">\r\nforeach my $image (@ARGV) {\r\n\t$image = quote_file_name($image);\r\n\t`\/usr\/bin\/exiftool -geotag= -overwrite_original $image`;\r\n}\r\n\r\n# utility function to sanitise file names for use when shelling out\r\nsub quote_file_name{\r\n    my $file = shift;\r\n    $file =~ s\/(&#x5B;`&quot;\\\\\\$])\/\\\\$1\/g;\r\n    return &#039;&quot;&#039;.$file.&#039;&quot;&#039;;\r\n}\r\n<\/pre>\n<p>Finally, it would be very helpful to have the service tell us when it is finished, so this is where Growl comes in. If you have it installed, drag and drop a <code>Show Growl Notification<\/code> into the workflow and enter a message of your choice.<\/p>\n<p>Your Service should now look something like the screenshot below. You can now go ahead and save the Service and give it a sensible name like <code>Strip Geotag<\/code>.<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bartbusschots.ie\/blog\/wp-content\/uploads\/2012\/12\/Screen-Shot-2012-12-29-at-17.17.491.png\" alt=\"Screenshot of the finished Service\" style=\"border-width:0px;\" width=\"490\" height=\"381\" \/><\/p>\n<p>You should now be able to use the service by right-clicking on a file in the Finder and choosing your new service from the Services section. If you have only a few services installed they will be shown at the bottom of the contextual menu, if you have more, they will show in a sub-menu titled <code>Services<\/code>.<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bartbusschots.ie\/blog\/wp-content\/uploads\/2012\/12\/Screen-Shot-2012-12-29-at-17.21.19.png\" alt=\"The Service in Use in the Finder\" style=\"border-width:0px;\" width=\"490\" height=\"427\" \/><\/p>\n<p>I&#8217;ve included a zipped version of my service below. This service uses the Growl action, so if you don&#8217;t have Growl installed you&#8217;ll need to open the Service in Automator and remove the Growl action before you can use the Service.<\/p>\n<h3>Download<\/h3>\n<ul>\n<li><a href=\"http:\/\/www.bartb.ie\/linkStore\/blog\/AutomatorServices\/StripGeotag1.0.zip\" target=\"_blank\">Strip Geotag Service Version 1<\/a> (Requires Growl and EXIFTool)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2011 I wrote a blog post explaining how to create an OS X Service for stripping keywords from image files. In this post we&#8217;ll use the same technique to create a Service for stripping geotags from JPEG images. As with the keyword stripping service, there are two prerequisites for this action, one is [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[12,440,22,16],"tags":[269,26,268,456,457,458],"series":[],"class_list":["post-2393","post","type-post","status-publish","format-standard","hentry","category-computers-tech","category-tech-projects","category-photography","category-programming","tag-automator","tag-os-x","tag-scripting","tag-services","tag-software-release","tag-tutorial"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7t9xK-CB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/2393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/comments?post=2393"}],"version-history":[{"count":2,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/2393\/revisions"}],"predecessor-version":[{"id":7471,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/2393\/revisions\/7471"}],"wp:attachment":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/media?parent=2393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/categories?post=2393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/tags?post=2393"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/series?post=2393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}