Skip to content

Instantly share code, notes, and snippets.

@ibolmo
Created June 20, 2018 15:43
Show Gist options
  • Save ibolmo/c08973f5d4534ae2ff13f38e02f9e286 to your computer and use it in GitHub Desktop.
Save ibolmo/c08973f5d4534ae2ff13f38e02f9e286 to your computer and use it in GitHub Desktop.
Copy an image (from URL) into your clipboard
#!/bin/bash
tmp_image_file="$TMPDIR.imgpbcopy.png"
curl $1 > $tmp_image_file
osascript -e "set the clipboard to (read (POSIX file \"$tmp_image_file\") as JPEG picture)"
  1. Download the file
  2. Open up the terminal
  3. chmod +x imgpbcopy
  4. (optional) Move the script to a folder that is in your PATH (echo $PATH to see the folders). a. Can also add to your PATH a ~/bin/ folder like so: PATH=~/bin:$PATH in your .bashrc or .zshrc file.
  5. In the terminal you can now do: imgpbcopy https://zapier.com/brand/assets/images/logos/zapier-logo.png
  6. Try in Slack, Google Docs, Jira, or Quip!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment