I needed something to create base64 images to put into stylesheets and wanted to use the base64 that comes with Mac OS X. If you do not have base64 installed, you can use either Macports or Homebrew in order to get it.

This applescript will prompt you to select an image file and then bring up a dialog with the base64 encoded string already formatted for use in a stylesheet as CSS.

set source_file to choose file of type "public.image" with prompt "Please select image."
tell application "System Events"
    set file_path to POSIX path of source_file
end tell
tell application "Finder"
    set fileExtension to name extension of source_file
end tell
set shell_script to "base64 -i " & file_path
set base64_data to do shell script shell_script
set css_base64_data to "background-image:url(data:image/" & fileExtension & ";base64," & base64_data & ");"
set question to display dialog "Copy and paste this into your stylesheet" default answer css_base64_data buttons {"Copy to Clipboard", "Close"} default button 1 cancel button 2 with title "Base64 Image"
set answer to button returned of question
if answer is equal to "Copy to Clipboard" then
set the clipboard to css_base64_data
end if