Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to quickly create a "Convert to data URI" context menu option on Mac


  1. Download and unpack
  2. Rename to data-uri and copy to /usr/local/bin/
  3. Open Terminal, cd /usr/local/bin/ and and then chmod +x data-uri (enter password when prompted)
  4. Open Automator, choose New > Service.
  5. Set up the service as follows:
    Service receives selected files or folders in
    which is connected to a Run Shell Script action, with the following settings:
    Shell: /bin/bash
    Pass input: as arguments
  for f 
    /usr/local/bin/data-uri "$f" | pbcopy

And save as convert-to-datauri
See for a visual overview.

How to use

Right click on any file and select the convert-to-datauri option in the Services submenu. The data URI is copied to the clipboard and is ready to be pasted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.