Convert a file to base64 in Linux terminal

base64 -w 0 sourcefile.jpg > base64-code-saved-in-textfile.txt