The Imgur-Screenshot uploader for Linux/OS X from imgur.com/apps
- select area of your screen
- The screenshot is uploaded to imgur
- Upload screenshot or image file
- Use any screenshot tool
- Edit image before uploading
- Upload anonymously or to your imgur account
- Copy link to clipboard
- Open uploaded image
- Delete image from disk after upload
- Filenames, links and deletion links are stored
- Get notifications about updates
The edit feature is very interesting for automization with something like ImageMagick, or to quickly add notes.
Clone the repo and check if you have all dependencies installed:
imgur-screenshot --check
That's it.
Bind the script to a hotkey or add it to your $PATH for quick access ;)
Enjoy!
imgur-screenshot [[-c | --connect] | --check | [-v | --version] | [-h | --help]] | [[-o | --open=true|false] [-e | --edit=true|false] [-l | --login=true|false] [-k | --keep_file=true|false] [file]]
short | command | description |
---|---|---|
-h | --help | Show help, exit |
-v | --version | Print current version, exit |
--check | Check if all dependencies are installed, exit | |
-c | --connect | Show connected imgur account, exit |
-o | --open=true|false | override open config -o is equal to --open=true |
-e | --edit=true|false | override edit config -e is equal to --edit=true |
-l | --login=true|false | override login config -lis equal to --login=true |
-k | --keep_file=true|false | override keep_file config |
file | instead of uploading a screenshot, upload file |
All you need to do is simply run imgur-screenshot
.
imgur-screenshot --connect # shows you which account you're connected to
imgur-screenshot -l
_Making a selection:_
![Selection](https://i.imgur.com/3G7BmdV.png)
(Most are probably pre-installed)
Tip: Use --check to see what's missing.
- curl
- grep
- Linux only:
- libnotify-bin
- scrot
- xclip (needed for
copy_url
) - OS X only:
- terminal-notifier or growlnotify
This will not work on Windows. (maybe with cygwin?)
I have successfully tested this on Ubuntu and OS X.
If this won't work on your OS, create a new issue.
Config options are explained below.
The default config can be overridden at ~/.config/imgur-screenshot/settings.conf
:
imgur_anon_key="486690f872c678126a2c09a9e196ce1b"
imgur_icon_path="$HOME/Pictures/imgur.png"
imgur_acct_key=""
imgur_secret=""
login="false"
credentials_file="$HOME/.config/imgur-screenshot/credentials.conf"
file_name_format="imgur-%Y_%m_%d-%H:%M:%S.png" # when using scrot, must end with .png!
file_dir="$HOME/Pictures"
upload_connect_timeout="5"
upload_timeout="120"
upload_retries="1"
screenshot_select_command="scrot -s %img" # OS X: "screencapture -i %img"
screenshot_window_command="scrot %img" # OS X: "screencapture -iWa %img"
edit_command="gimp %img"
edit="false"
edit_on_selection_fail="false"
open_command="xdg-open %url" # OS X: "open %url"
open="true"
log_file="$HOME/.imgur-screenshot.log"
copy_url="true"
keep_file="true"
check_update="true"
-
imgur_anon_key
The imgur API key used for anonymous upload. Don't change this unless you have a valid key
-
imgur_acct_key
The imgur API key used to upload to your account.
-
imgur_secret
The imgur API secret. Don't change this unless you have a valid secret and would like to upload to your account.
-
imgur_icon_path
The path to the imgur favicon file (download here).
Has to be a file in your file system, links do not work.
Will be shown as icon for notifications. -
login
If set to true, the script will try to upload to your account
-
credentials_file
The file used to store your account credentials
-
save_file
If set to false, the file will be deleted after upload.
-
file_name_format
The format used for saved screenshots. more info
-
file_dir
Optional. The path to the directory where you want your images saved.
-
upload_connect_timeout
Maximum time in seconds until the connection to imgur should be established.
-
upload_timeout
Maximum time the whole upload procedure may take.
-
upload_retries
Amount of retries that will be done if the upload failed.
-
screenshot_select_command
Command to create a selective screenshot and save it to
%img
-
screenshot_window_command
Command to grab the active window and save it to
%img
On debian, you can usescrot -u %img
to capture the active window instead of the whole screen (Used when selective screenshot cannot be taken, see #1) -
edit
If set to true, make use of edit_command
-
edit_command
An executable that is run before the image is uploaded.
The image will be uploaded when the program exits.
%img
is replaced with the image's filename. -
edit_on_selection_fail
When the selective screenshot fails, open the (full screen) image with edit_command (see #1)
-
open_command
An executable that is run after the image was uploaded.
%img
is replaced with the image's filename.
%url
is replaced with the image's URL. -
open
If set to true, open url after image uploaded.
-
log_file
The path to the logfile.
The logfile contains filenames, URLs and errors. -
copy_url
If set to true, the image URL will be copied to clipboard.
-
keep_file
If set to false, the file will be deleted. Only deletes screenshots.
-
check_update
If set to true, it will check for updates after the upload. This will not apply the update, just notify you if there's a new version.
The screenshot will be taken after the selection has been made. This could be annoying if you want to capture something quickly and then want to select an area. I might implement this as a FutureFeature™ when I find a decent way to capture the whole screen, display the shot in full screen and then crop it to a selection.
If you get a notification like
Something went wrong :(
Information logged to /foo/bar/logfile.log
This probably means that scrot -s
/screencapture -i
was unable to make a selective screenshot.
- You pressed the any key during selection
- (OS X / screencapture) you didn't make a selection or pressed Esc.
- Note: This is a bug which I have reported to Apple. It's fixed in OS X Yosemite
- (Linux / scrot)
sleep 0.1
in the script didn't help. Try increasing the value- Note: A short sleep is required, otherwise scrot handles the hotkey you're using for imgur-screenshot as any key to cancel the selection
- You don't have permission to write the file
- One of the dependencies is not installed
- You don't have your display plugged in (wrong terminal?) >_<
- ?? - run
scrot -s
/screencapture -i
directly and check the outcome
- Report issues
- Submit feature request
- Make a pull request
- Buy me a beer: [
1DkuhsBLipitcCHKcDHhpxUYPiFUBD4nvf
]