Skip to content

Instantly share code, notes, and snippets.

@bmoore
Created May 28, 2013 18:02
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 bmoore/5664730 to your computer and use it in GitHub Desktop.
Save bmoore/5664730 to your computer and use it in GitHub Desktop.
Upload image selection to imgur, and pipe the image url to xclip. Based on http://sirupsen.com/a-simple-imgur-bash-screenshot-utility/
#!/bin/bash
function uploadImage {
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" https://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*"
}
import shot.png
url=`uploadImage "shot.png"`
echo $url
echo $url | xclip -selection c
rm shot.png
@bmoore
Copy link
Author

bmoore commented May 28, 2013

Depends upon imagemagick's import utility, curl, grep, and xclip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment