Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Create a base64 data URI from an image and copy it to clipboard.
  4. # Uses OpenSSL to create the base64 representation.
  5.  
  6. the_mimetype=$(file -bN --mime-type "$1")
  7. the_content=$(openssl base64 < "$1" | tr -d '\n')
  8.  
  9. # Use printf instead of echo to avoid the ending newline
  10. printf "data:$the_mimetype;base64,$the_content" | pbcopy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement