Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Create a base64 data URI from an image and copy it to clipboard.
- # Uses OpenSSL to create the base64 representation.
- the_mimetype=$(file -bN --mime-type "$1")
- the_content=$(openssl base64 < "$1" | tr -d '\n')
- # Use printf instead of echo to avoid the ending newline
- printf "data:$the_mimetype;base64,$the_content" | pbcopy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement