Convert An Image To base64 On The Command Line
Use the `base64` command with the `> filename` operator to convert an image to base64 and save the string in a file:
Code
base64 IMAGE_FILE.jpg > OUTPUT.txt
You can also export it into an environmental variable for use in other scripts
Code
export IMAGE_STRING=$(base64 IMAGE_FILE.jpg)
echo $IMAGE_STRING