Skip to content

Instantly share code, notes, and snippets.

@jatin-lab49
Created June 23, 2021 13:13
Show Gist options
  • Save jatin-lab49/d5699340c92bbb063d7b073808ccebef to your computer and use it in GitHub Desktop.
Save jatin-lab49/d5699340c92bbb063d7b073808ccebef to your computer and use it in GitHub Desktop.
TIL-Lab49/Get a base64 version of image file locally

Maybe this is common knowledge. For most cases whenever I needed a base64 version of an image to use in a webpage, I used one of those online sites to get it.

Recently on a client project I wasn't sure if I wanted to upload their images on an unknown site. So I did a quick Google (fine, stackoverflow) and found that we can just run this on most Linux style systems.

cat image-file.jpg | base64

Also works on macOS and for other image types

cat aws-lambda-with-alb.png | base64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment