imgur

Upload images to imgur.com

npm install imgur -g

Pass binary image files, urls, and/or base64-encoded image strings as arguments. Globbing is supported.

Upload a single image:

imgur cat.png

Upload multiple images (globbing supported):

imgur cat.png cats.gif cats23.jpg
 
imgur ~/*.(jpg|png|gif)
 
imgur ~/Pictures/kittens/*.jpg ~/gifs/sfw/*.gif

Upload an image from another place on the web. Be sure to include http(s):

imgur --url https://octodex.github.com/images/topguntocat.png

Upload a Base-64 encoded image:

imgur --base64 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC

Saving a client id for subsequent use:

imgur --save f9ae01148b53261

Display saved client id:

imgur --show

Remove previously saved client id:

imgur --clear

Use a specific client id one time only (overrides saved id):

imgur --client-id f9ae01148b53261 --file ~/me.jpg
 
# Short-hand
imgur -c f9ae01148b53261 -f ~/me.jpg
npm install imgur
var imgur = require('imgur');
// Setting 
imgur.setClientId('aCs53GSs4tga0ikp');
 
// Getting 
imgur.getClientId();
 
// Saving to disk. Returns a promise. 
// NOTE: path is optional. Defaults to ~/.imgur 
imgur.saveClientId(path)
    .then(function () {
        console.log('Saved.');
    })
    .catch(function (err) {
        console.log(err.message);
    });
 
 
// Loading from disk 
// NOTE: path is optional. Defaults to ~/.imgur 
imgur.loadClientId(path)
    .then(imgur.setClientId);
// A single image 
imgur.uploadFile('/home/kai/kittens.png')
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });
 
// All jpegs in a specific folder 
imgur.uploadFile('/home/kai/*.jpg')
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });
 
// Multiple image types from home folder 
imgur.uploadFile('~/*.(jpg|png|gif)')
    .then(function(json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });
var kittenPic = 'mbgq7nd';
imgur.getInfo(kittenPic)
    .then(function(json) {
        console.log(json);
    })
    .catch(function (err) {
        console.error(err.message);
    });
 
// Include http(s) when specifying URLs 
imgur.uploadUrl('https://octodex.github.com/images/topguntocat.png')
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });
var imgurFavicon = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC';
 
imgur.uploadBase64(imgurFavicon)
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });