SHARE
TWEET

Untitled

a guest Aug 17th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top