Use Terminal to base64 encode an image

Generate base64 version of an image:

openssl base64 < path/to/file

Do the same, but remove line breaks:

openssl base64 < path/to/file.png | tr -d '\n'

Do the above, but copy the result to the clipboard:

openssl base64 < path/to/file.png | tr -d '\n' | pbcopy