Giter Site home page Giter Site logo

imgur-screenshot's Introduction

The Imgur-Screenshot uploader for Linux & OS X from imgur.com/tools

Imgur-Screenshot

  1. select area of your screen
  2. The screenshot is uploaded to imgur

screenshot gif

Features

  • Upload screenshot or image files
  • Copy link to clipboard
  • Customizable configuration
  • Edit image before uploading
  • Upload anonymously or to an account
  • Create and add to albums
  • Filename, link, and deletion link history is stored
  • Automatic image deletion
  • Update notifications

The edit feature can be used for automated editing with something like ImageMagick, or just to quickly add notes.

Contributing

  • Report issues
  • Submit feature request
  • Make a pull request
  • Get imgur-screenshot on more package managers!

See also: CONTRIBUTING.md

Installation

Install on Mac via Homebrew

brew update && brew install imgur-screenshot

Install on ArchLinux via AUR

See imgur-screenshot for the stable version, and imgur-screenshot-git for the development version.

Install on CentOS and Fedora via COPR

See valdikss/imgur-screenshot on COPR.

Install on NixOS via Nix

See imgur-screenshot on Hydra.

Install via git

git clone https://github.com/jomo/imgur-screenshot.git

Download source

Alternatively, you can download imgur-screenshot from releases.
These builds have auto-update.patch applied, allowing to update via --update.


Make sure you have all dependencies installed (see below).

That's it.
Bind the script to a hotkey or add it to your $PATH for quick access ;)

Enjoy!

Usage

Note: You can override the default configuration in ~/.config/imgur-screenshot/settings.conf.
Check out the wiki for more!

imgur-screenshot [--debug] [-c | -v | -h | -u]
imgur-screenshot [--debug] [optiion]... [file]...

Run imgur-screenshot -h to see all command line options.

Uploading a screenshot

All you need to do is simply run imgur-screenshot.

Uploading a screenshot to your account

imgur-screenshot -c # shows you which account you're connected to
imgur-screenshot -l true

Dependencies

  • curl
  • jq
  • Linux only:
  • libnotify-bin
  • scrot (or other screenshot tool)
  • xclip (needed for copy_url)
  • macOS only:
  • terminal-notifier or growlnotify

OS support

With the above dependencies installed, imgur-screenshot should work on most UNIX systems.
This will not work on Windows. (maybe with cygwin?)
I have successfully tested this on Ubuntu and macOS.
If this won't work on your OS, create a new issue.

Note

The screenshot will be taken after the selection has been made. This might be annoying if you want to capture something quickly and then want to select an area. However, you can take a full shot and use the edit option to crop the image before upload.

imgur-screenshot's People

Contributors

a0726h77 avatar agung-wete avatar ento avatar jayay avatar jomo avatar nahakiole avatar noerk avatar protist avatar readmecritic avatar valdikss avatar vitorgalvao avatar winmain avatar xxyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imgur-screenshot's Issues

Ability to cancel

At the moment pressing escape (scrot) will take a full screen screenshot instead. I think we'd be doing our bandwidth and imgur a favor on this one.

-d command does not work

According to the documentation, this command:

imgur-screenshot.sh -d 10

should delete the image after 10 seconds however, the image is never deleted automatically. Here is the output I got from entering that command:

booker@booker-MS-7681:~$ imgur-screenshot.sh -d 10
Please select area
Uploading '/home/booker/Pictures/imgur-2015_04_13-20:00:19.png'...
Deleting image in 10 seconds.
image  link: https://i.imgur.com/b39rEb9.png
delete link: https://imgur.com/delete/mJGn5VwTrb2F36J
nohup: appending output to ‘nohup.out’
URL copied to clipboard
Opening 'xdg-open https://i.imgur.com/b39rEb9.png'
Version 1.5.1 is up to date.
booker@booker-MS-7681:~$ Created new window in existing browser session.

I am running Ubuntu 14.10.

Request: option to resample dpi for retina screens

In retina screens, although we see the screenshots we take at the same size we see what the took a screenshot from, when sending it to imgur, what we’ll get back is an image much larger (in width/height terms). This is due to the dpi of the images themselves. Link to a post explaining it further.

Although sometimes desirable, it is conversely sometimes undesirable as well, so it’d be good to have an option to resample the image before uploading. Most of the work can already be found in the form of a script.

increasing upload_connection_timeout values

tl;dr: line 40, upload_connection_timeout='5' isn't enough for large image file or slow connection, so i suggest to increase it to 10 (or larger) or remove it from the parsing options for cURL.

Old issue: #42

When using new file from master branch, the curl(3) error is no more, but it's still failed to upload

$ ./imgur-screenshot.sh 
Please select area
Uploading '/home/yumeko/Pictures/Screenshots/imgur-2015_07_22-23:21:27.png'...
Upload failed: "curl: (28) Resolving timed out after 5513 milliseconds"

Version v1.5.4 is up to date.

From the --debug option, i see the connection time isn't enough for large image files

$ curl --compressed --connect-timeout 5 -m 120 -fsSL --stderr - -H 'Authorization: Client-ID 9e603f08c0e541c' -F title=imgur-2015_07_22-23:13:42 -F image=@/home/yumeko/Pictures/Screenshots/imgur-2015_07_22-23:13:42.png https://api.imgur.com/3/image                                       
curl: (28) Resolving timed out after 5515 milliseconds

So i tries to increase it to 10, or remove it from the parsing options

$ curl --compressed -m 120 --retry 1 -fsSL --stderr - -H 'Authorization: Client-ID 9e603f08c0e541c' -F title=imgur-2015_07_22-23:13:42 -F image=@/home/yumeko/Pictures/Screenshots/imgur-2015_07_22-23:13:42.png https://api.imgur.com/3/image                     
{"data":{"id":"dOXCu2z","title":"imgur-2015_07_22-23:13:42","description":null,"datetime":1437581795,"type":"image\/png","animated":false,"width":662,"height":557,"size":325847,"views":0,"bandwidth":0,"vote":null,"favorite":false,"nsfw":null,"section":null,"account_url":null,"account_id":0,"comment_preview":null,"deletehash":"LYgnZm2H8aBTDSM","name":"","link":"http:\/\/i.imgur.com\/dOXCu2z.png"},"success":true,"status":200}%

And well, the result's there.

Upload anonymously

Add a flag which uploads it anonymously instead of to your account if you have an account connected.

Add a flag for full screenshot

Hello,

Right now, when launching the application a selection of a portion of the screen is needed. I press esc to have it not upload, so there is now way at the moment to fire up screenshot_window_command with exit_on_selection_fail set to true.

I think it would be nice to have, maybe, an -f flag to trigger the screenshot_window_command instead of screenshot_select_command to work with exit_on_selection_fail.

Thanks.

-u command bug

When I enter the -u command:

imgur-screenshot.sh -u

I receive the following output:

Version v1.5.1 is available (You have v1.5.3)
Check https://github.com/jomo/imgur-screenshot/releases for more info.

Similarly, when I invoke the script:

imgur-screenshot.sh

I receive the following output:

booker@booker-MS-7681:/usr/local/bin$ imgur-screenshot.sh 
Please select area
Uploading '/home/booker/Pictures/imgur-2015_04_14-08:56:49.
...
Update found!
Version v1.5.1 is available (You have v1.5.3)
Check https://github.com/jomo/imgur-screenshot/releases for more info.

Obviously version 1.5.3 is more recent than version 1.5.1.

I am running Ubuntu 14.10.

--auto-delete should be --auto_delete

_ instead of -, to be consistent with the other options. I’d submit a PR now, but that would conflict with #52, which needs to be handled first.

I’d also like to run other consistency improvements in help (capitalisation is inconsistent) and in the script as a whole ( $var and ${var} are used interchangeably without good logic), but those are all dependent on the aforementioned PR.

Do i have to close the script after using it?

So when I use this script on the terminal on linux, it works but i have to ctrl+c to end it after it is done. Does that mean if I bind it to a shortcut it will have multiple instances open for every time i take a screenshot? Thanks, and sorry if the questions out of place, I just don't know where to put it.

File Upload always fails

I have connected with my imgur account with this library. But When ever I try to upload a file it always shows upload failed. I have tried with different network but with no result.

The log file says:
Error /home/pcuser/Desktop/imgur-screenshot-master/egcon.png Upload failed: ""

What could be the the issue here?

Support the albums

Is it possible to add a function to upload images to an existing album or create a new album?

Notification and mouse cursor on select area

First, it'd be nice to have a notification by notify-send when the script start

notify-send -i "/path/to/imgur/icon.png" "Imgur Screenshot" "Please select area"

Second, when selecting area, please change cursor to "select mode" (something like plus sign), because

  • If you start to drag cursor from an empty zone, it works fine.
  • If you start to drag cursor from a text field, like terminal, text editor zone, ..., it'll select texts from the text field, not capture area mode from the script.

So, making the cursor change to "select mode" to ignore all of the other program's mouse action until you're done with selecting area to take screenshot, it'd be nice.

Uploading existing screenshot does not provide delete URL

This is what the Bash Script Uploader shows when uploading an image

$ imgur imgur-08.02.2014-11\:58\:41.png 
http://i.imgur.com/IedjtDp.png
Delete page: http://imgur.com/delete/<delete code>

And this is what imgur-screenshot shows

$ imgur-screenshot.sh imgur-08.02.2014-11\:58\:41.png 
Uploading 'imgur-08.02.2014-11:58:41.png'...
http://i.imgur.com/lRraE1l.png
URL copied to clipboard
cat: /usr/local/bin/.version.txt: No such file or directory
Version  is up to date.

imgur-screenshot does not give me an URL to delete the image.

Open is set to false but its still opening in browser

Hey!

I have this set in the config:

...
file_dir="$HOME/Pictures/screenshots"
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"
exit_on_selection_fail="true"
edit_on_selection_fail="false"
exit_on_album_creation_fail="true"
open="false" // OPEN IS SET TO FALSE
log_file="$HOME/.imgur-screenshot.log"
copy_url="true"
keep_file="true"
check_update="true"

but when I take a screenshot, it still opens in Google Chrome.

Thanks.

Missing config

Is there anywhere else the settings.conf could be? I'm trying to put in my client id and secret but I've been searching around my file system for about an hour now with no results. I can upload screenshots anonymously so it must be there. I don't even have an imgur-screenshot directory under my .config. I'm running crouton on a chromebook with ubuntu 12.04. Sorry I had to bug you over this, but my Googlefu wasn't strong enough.

Auto-delete

I believe most people use this tool to upload screenshots that won't ever be accessed again 10 minutes later.
It would be a nice feature to be able to automatically delete uploaded images after a configurable time. Imgur would probably be happy, too :)

Perhaps using flags could negate the default behaviour from the config.

When the program is ran by a hotkey it wouldn't be a problem to just wait the specified time. But in case it's ran from a terminal, it would be a bit annoying to block the console for that time, so it would be nice to automatically put it in the background somehow.

upload an entire directory of images as an album

it would be cool to be able to:

imgur-screenshot.sh --album some_album_name /path/to/some/dir/of/images

and have it upload all of the images in there to an album.

here is some stuff that might be helpful:

https://help.imgur.com/hc/en-us/articles/201424906-What-file-types-are-allowed-

What file types are allowed?
Sarah Schaaf - March 16, 2015 16:08

JPEG, PNG, GIF, APNG, TIFF, BMP, PDF, XCF (GIMP). Please note that TIFF, BMP, PDF and XCF (GIMP) will be converted to PNG on upload. PNGs over 756KB are automatically converted to JPG.

some code that should work for that:

ls | egrep -i '\.jpg$|\.jpeg$|\.jpe$|\.jif$|\.jfif$|\.jfi$|\.png$|\.gif$|\.apng$|\.tiff$|\.tif$|\.bmp$|\.pdf$|\.xcf$'

^ that should search for all allowed image files (and is case-insensitive for those extensions because of the -i flag)

what do you think? do you like the idea?

uploading file with ',' or ';' in filename

~/Pictures/screenshots $ imgur-screenshot.sh  Star.trek.TNG.s02e03.Elementary,Dear.Data.mkv_000103.564.jpg
Uploading '/home/user/Pictures/screenshots/Star.trek.TNG.s02e03.Elementary,Dear.Data.mkv_000103.564.jpg'...
Upload failed: "curl: (26) couldn't open file "/home/user/Pictures/screenshots/Star.trek.TNG.s02e03.Elementary""

Version v1.6.1 is up to date.

net-misc/curl - Installed versions: 7.43.0

In the curl this error is fixed for a long time - curl now can uploading file with ',' or ';' in filename.

Decide function definition style

Currently, function definitions follow the form function function_name() {…. That doesn’t make sense in bash, where we don’t put anything between the (). It should either be function function_name {… or function_name() {…, never both.

The final pick is a stylistic choice, so rather than submit a PR, a issue is more appropriate.

look for .version.txt somewhere else

Current version of script looks for .version.txt in the same directory where the script is, which could be not suitable if script is installed in /usr/bin. Could we move it somewhere else?

403 Permission Denied

I'm getting this error whenever I take a screenshot with the program. I have all the dependencies installed. I haven't used this program for over a month, but I know back in February this did work for me. I'm running Ubuntu 15.10 64-bit. This error pops up in the Ubuntu notification.:

Imgur: Upload failed :(
curl: (22) The requested URL returned error: 403 Permission Denied

I have also not modified the program in any way (e.g. adding my own imgur account IDs from API).

scrot option -u doesn't exist

ArchLinux
Linux hive 3.14.3-2-ARCH #1 SMP PREEMPT Mon May 12 20:52:20 CEST 2014 x86_64 GNU/Linux
scrot version 0.8

felipe@hive ~ % scrot -u
scrot: invalid option -- 'u'

re-uploading images to imgur

do you know if the imgur api allows for re-uploading images to imgur (e.g. urls of images hosted elsewhere)?

you can do this from the imgur website. can be useful for re-hosting images hosted on 'bad' image hosts.

https://i.imgur.com/4a1vdX5.png

if it's possible, it would be a cool feature addition.
possibly used like:
imgur-screenshot.sh [options] URLtoReuploadToImgur

i suppose the image could be temporarily downloaded to a temp dir and then uploaded, but when you use the feature on imgur's website, i assume imgur's servers do the downloading for you

Upload failed: "curl: (3) <url> malformed

Well, this tool worked fine for me before. But recently, I got this message error and don't know how to solve.
The screenshot's made, but it can't be uploaded.

$ imgur-screenshot           
Please select area
Uploading '/home/yumeko/Pictures/Screenshots/imgur-2015_07_22-20:03:48.png'...
Upload failed: "curl: (3) <url> malformed
curl: (28) Resolving timed out after 5514 milliseconds"

Version v1.5.4 is up to date.

Clean up bash

There are some issues with the code as i see it:

  1. scope issues - function variables should be localized to avoid scope conflicts;
  2. variable naming convention - I'd propose defining all global vars in caps, local ones in lower case. Depends in implementing the first point.
  3. duplication - there's still unnecessary code duplication.
    ...

Seems that api has changed

I get this now

Error: Couldn't get access token from 'https://api.imgur.com/oauth2/token'

And the webpage says that some required fields were missing

.version.txt not found when script is linked

When uploading an existing image I get an cat: /usr/local/bin/.version.txt: No such file or directory error;

$ imgur-screenshot.sh imgur-08.02.2014-11\:58\:41.png 
Uploading 'imgur-08.02.2014-11:58:41.png'...
http://i.imgur.com/lRraE1l.png
URL copied to clipboard
cat: /usr/local/bin/.version.txt: No such file or directory
Version  is up to date.

I cloned the git to ~/bin/ so the .version.txt file is in ~/bin/imgur-screenshot/.version.txt.
Then I symlinked the script;

$ readlink /usr/local/bin/imgur-screenshot.sh 
/home/brott/bin/imgur-screenshot/imgur-screenshot.sh

and the script tries to look for .version.txt where the link is located.

and as a bonus, there is a spacing error at the last line in that code up there ^
It's caused by line 81 because there are spaces before and after $current_version, and for me it never outputs $current_version so there is just two spaces.

Notify-send does not time out

notify-send -t 500 does not time out, in fact using -t anything makes it not timeout. had to remove -t 500 from config to get notifications to go away on their own.

This is not an issue with your script, it is an issue with notify-send and the GUI counterpart. Looking up the issue gets to the point of the makers saying "This is not a bug, it's a feature!" Notify-send still has that option listed, but the GUI counterpart disregards or breaks when that option is used.

Config file in separate file

How about put config / setting in separate file.

So if we do git fetch / update, dont have to re-edit the config variabel

👍

Customize how link is copied

I'd like to use screenshots from imgur into some chats like gitter, slack, and even org-mode for emacs, in the latter it's not so much of a trouble as one can do C-c C-l and it captured the clipboard link. But it would be awesome if we could do sth like imgur-screenshot --wrapper "[![alt_text](%s)](%s)]" and that would give a link in the clipboard as this:
[![alt_text](https://i.imgur.com/7qYlP3Z.png)](https://i.imgur.com/7qYlP3Z.png)
so that we could paste it directly in github issues too like this:
alt_text

imgur-screenshot.sh --check doesn't work on Linux

I'm running Ubuntu 15.10. Performing the command "imgur-screenshot.sh --check" in the directory where imgur-screenshot is installed does not do anything (I get "command not found"). To clarify, I did see the .README and was able to install the dependencies like I normally would.

Window Screenshot Mode

I think it would be useful to have a parameter to take a screenshot of a full window by default instead of prompting to select an area. This could be either in the form of a configuration parameter or a command line argument. Is this something you would consider adding to the script?

Fails when application has control over cursor

This script works fine, except when the cursor is occupied by another application or similar.
Basically, when I have a game like Minecraft open, Minecraft is using the cursor. When I run this script from a hotkey, scrot(?) cannot get a hold of the cursor so it fails. The cursor has to be free, as if I were to pause the game.

Opening a terminal first makes minecraft loose focus and I get my cursor, which works, but I'd rather have it bind to a key.

Is there a way for the script to make what is having the mouse occupied to free the cursor? Or is there some other way I can fix this?

No way of cancelling

If I start to make a selection, there is no way of cancelling it. If I press ESC it does "cancel" it, but it (scrot I guess) instead screenshots the entire window.

I would like pressing ESC, or maybe some assigned key like LCTRL to cancel the upload. I don't care if scrot actually takes a screenshot, but the script should not upload it.

Script filename

Wouldn't running this require the extension: imgur-screenshot.sh? I would also advise clarifying that ./ is needed if PATH is not set.

GREP_OPTIONS is deprecated

I get this when running the script:

grep: warning: GREP_OPTIONS is deprecated; please use an alias or script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.