Skip to content

Instantly share code, notes, and snippets.

@glegoux
Last active June 25, 2018 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glegoux/57af279ff22629594830418fc5bbdb53 to your computer and use it in GitHub Desktop.
Save glegoux/57af279ff22629594830418fc5bbdb53 to your computer and use it in GitHub Desktop.
[Bash] Convert image PNG to base 64 and copy
#!/usr/bin/env bash
cd $(dirname "$0")
img_file="$1"
# data:image/png;base64,<content base 64>
# data:image/svg+xml;base64,<content base 64>
base64 -w 0 "${img_file}" | xclip -selection c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment