11

Is there a way I can upload some photos to imgur.com via the command-line and get their direct link as result in a text file?

Seth
  • 57,282
  • 43
  • 144
  • 200
αғsнιη
  • 35,092
  • 41
  • 129
  • 192
  • possible duplicate of [How to take a screenshot and then upload the image to imgur through terminal?](http://askubuntu.com/questions/417295/how-to-take-a-screenshot-and-then-upload-the-image-to-imgur-through-terminal) – Avinash Raj Nov 02 '14 at 02:40
  • 2
    @AvinashRaj I don't think it's a duplcate, this question isn't about taking screenshots, just uploading them. – Seth Nov 02 '14 at 03:41
  • @Seth linked question covers the uploading part also. – Avinash Raj Nov 02 '14 at 03:43
  • 2
    @AvinashRaj Yes it does, but that doesn't make it a duplicate. The answers might be similar, but the questions are still different. – Seth Nov 02 '14 at 03:47

2 Answers2

19

The list of (mostly third-party) tools on the imgur website (https://i.stack.imgur.com/7E7EQ.jpg) features three bash scripts:

  • Bart's Bash Script Uploader by Bart Nagel

    A simple bash script to upload an image to imgur from the commandline. Run imgur images/delicious/cake.jpg to upload, print the new URL to stdout, print the delete page URL to stderr and put URL on the X clipboard for easy pasting.

  • img Bash Script Uploader by Ceryn

    A minimalistic screenshot uploader for Linux. Supports screen selection.

  • Imgur-Screenshot by jomo

    A simple screenshot bash script for Linux and OS X. Just run the script and select a portion of your screen to upload. The direct link to the image is then copied to your clipboard.

tremby
  • 419
  • 4
  • 12
muru
  • 193,181
  • 53
  • 473
  • 722
  • Here is a simplified version for OSX (I arrived here when I googled this): https://gist.github.com/003044274b6176f66c22 – Dorian Jan 25 '16 at 23:09
2

i tried myself today on imgur and it's quite complex , the documentation is pretty bad written so the procedure is not clear . May i suggest to try imagebin.ca ?! cuz has a simpler API to upload files :

curl -s -F key="YOURKEY_JUST_REGISTER_ON_IMAGEBIN.CA_and go_on_profile_to get it" \
 -F file="@$1" \
 https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }'

if you are using linux and kde =>

qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents "$(curl -s -F key="YOURKEY_________PLEASE_EDIT_IT" \
 -F file="@$1" \
 https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }' )"
user1088530
  • 121
  • 2