Bart's Imgur uploader bash script
- By Bart Nagel firstname.lastname@example.org
- Improvements by Tino Sino email@example.com
- Other contributions from the Github community
Upload images to Imgur via a small bash script.
I received infrequent but steady emails over the years with thanks and suggestions for improvements. A Google search shows the script has been reused and forked many times over the years. About time this had its own Git repository, so maybe the improvements can find their way back to the source.
pbcopy, to automatically put the URLs on the X selection for easy pasting
Put it somewhere in your path and maybe rename it
mv imgur.sh ~/bin/imgur
Or you could make a symlink instead.
Make it executable
chmod +x ~/bin/imgur
Optional, since I've provided a client ID: add your client id to the top of the script, replacing the provided one, or set it as the
Single image from a URL
imgur images/delicious/cake.png https://example.com/exciting/bungeejump.jpg
Directly from a screenshot
import png:- | imgur
Note that the
importcommand above is from Imagemagick, and will await a selection being made on screen.
The new URLs will be displayed
(and the delete page URLs will be displayed on stderr).
If you have
the URLs will also be put on the X selection,
which you can then usually paste with a middle click.
If no filename is given, or if
- is given as one of the arguments,
an image is read from standard input.
There are some rate limits with the API. The daily upload limit is shared by everyone using the same client ID, so if you're using the provided one and start to get errors, you might consider using your own client ID.