Master Template

Useful Automator Scripts

Useful Apple Mac Automator Scripts

*** Find AUTOMATOR in your Applications folder ***

This is one Application that comes with your Apple Computer that I really enjoy using. It's the satisfaction of doing laborious tasks in an instant. Very Satisfying. Herewith some of the scripts that I've used to Automate different tasks.

The above Automator logo is actually code! It is not a referenced image file. It's Base64!

Create BASE64 code of an image. (gif, jpg, png & animated gif)

Your image is in the code of your html or PHP document as code. Why do this? Well it reduces http requests to the server for the image or images thus reducing load time. However weigh this up against an approximate 30% increase in relative file size. But, my usage is for HTML e-mail signatures. If you use code rather than images you can have the images load on the signature without the user having to select "view images" to see them. It has the added benefit of not showing up as an attachment (something I find very annoying). Have you ever looked for an attachment that isn't there?

Image to Base64 using Apple's Automator

  1. Launch Automator.app
  2. Create a new: Application
  3. Add: Run Shell Script action
  4. Set Shell: bin/zsh
  5. Set Pass input: as arguments
  6. Replace the arguments script generated with the script below.
  7. Save your workflow as an application

Automator Shell Script Action to convert an image to Base64 code.


export PATH=/usr/local/bin:$PATH
for f in "$@"
do
	echo "$f"
    openssl base64 -in "$f" -out "$f.b64"
done

Convert your first image

Drag a .jpg, .png, or .gif onto your newly created Automator Application. It will create the code in the same directory you dragged your image from. It will appear as a “.b64” file. Open it up in a text editor to copy and paste the code into your HTML or PHP document.

Add your Base64 code to a HTML or PHP document

Remember: Change the image type to correspond with the image you converted png, jpg or gif



<img src="data:image/png;base64,YOUR-BASE64-CODE-IN-HERE
" alt="Image Description" />


Useful Mac Automator Scripts

 

 

Please share if you find the content useful - thank you

Master Template World

Contact

Master Template Forum Robot

FORUM

Have a comment or something to say?
Say it here…

[privacy policy]