Skip to content

QuickImgur is a Python tool to upload images to Imgur and copy Markdown links to the clipboard. It supports pasting images from the clipboard, selecting files from any directory, or automatically uploading new images saved to specific directory by default Downloads.

Notifications You must be signed in to change notification settings

B4l3rI0n/QuickImgur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

QuickImgur

Python License Status

QuickImgur is a Python tool to upload images to Imgur and copy Markdown links (![](<url>)) to the clipboard. It supports pasting images from the clipboard, selecting files from your Downloads folder, or automatically uploading new images saved to Downloads. Perfect for bloggers, developers, or anyone needing quick image links for Markdown-based platforms like GitHub or Jekyll blogs.

Features

  • Clipboard Paste: Upload images copied to the clipboard (e.g., right-click > Copy Image).
  • File Selection: Choose images via a GUI file dialog from your Downloads folder.
  • Folder Monitoring: Automatically upload new images saved to ~/Downloads or configured directory.
  • Dual Mode: Run GUI and folder watcher simultaneously for seamless workflow.
  • Markdown Output: Copies ![](<imgur_url>) to the clipboard for easy pasting into blogs or READMEs.
  • Error Handling: Manages network issues, invalid clipboard content, and missing folders.
  • Configurable: Enable/disable GUI or watcher modes via simple flags.

Installation

  1. Clone the Repository:

    git clone https://github.com/B4l3rI0n/QuickImgur.git
    cd QuickImgur
    
  2. Set Up a Virtual Environment (Recommended):

    python3 -m venv .
  3. Install Dependencies:

    pip install requests Pillow pyperclip watchdog

    or if you are using venv

    ./bin/pip install requests Pillow pyperclip watchdog

    On Linux, you may need Tkinter:

    sudo apt-get install python3-tk xclip
  4. Get an Imgur Client ID:

    • Register at Imgur API.

    • Select: OAuth 2 authorization without a callback URL

    • Copy your Client ID.

    • Set it in quickimgur.py:

      IMGUR_CLIENT_ID = "your_client_id_here"

      Alternatively, use an environment variable:

      export IMGUR_CLIENT_ID="your_client_id_here"

      Add to ~/.bashrc or ~/.zshrc for persistence:

       echo 'export IMGUR_CLIENT_ID="your_client_id_here"' >> ~/.bashrc
       source ~/.bashrc

Usage

Run the script:

python quickimgur.py

GUI Mode

  • Prompt: Press 'p' to paste, 's' to select, or 'q' to quit:
  • Paste ('p'): Uploads an image from the clipboard.
  • Select ('s'): Opens a file dialog to choose an image from ~/Downloads or home directory.
  • Quit ('q'): Exits the script, stopping any folder monitoring.
  • Output: Copies ![](<imgur_url>) to the clipboard and prints results.

Folder Watcher Mode

  • Monitors ~/Downloads for new .png, .jpg, .jpeg, or .gif files.
  • Automatically uploads new images and copies Markdown links.
  • Runs in the background if ENABLE_WATCHER = True.

Configuration

Edit quickimgur.py to toggle modes:

ENABLE_GUI = True     # Enable/disable GUI prompt
ENABLE_WATCHER = True # Enable/disable folder monitoring
  • Both Modes: Default setting; GUI runs in foreground, watcher in background.
  • GUI Only: Set ENABLE_WATCHER = False.
  • Watcher Only: Set ENABLE_GUI = False.
  • Neither: Set both to False (exits with message).

Example Output

Press 'p' to paste, 's' to select, or 'q' to quit: 
Uploaded & copied to clipboard: ![](https://i.imgur.com/abc123.png) (from folder watcher)
Press 'p' to paste, 's' to select, or 'q' to quit: p
Uploaded & copied to clipboard: ![](https://i.imgur.com/xyz789.png)
Returning to menu...
Press 'p' to paste, 's' to select, or 'q' to quit: q
Exiting...

Requirements

Listed in requirements.txt:

requests
Pillow
pyperclip
watchdog
  • Python: .
  • OS: Tested on Linux (Kali); should work on Windows/Mac with Tkinter and clipboard support.
  • Dependencies: Install via pip install -r requirements.txt.
  • Clipboard: Requires xclip or similar on Linux for clipboard pasting.

Troubleshooting

  • No Downloads Folder: Ensure ~/Downloads exists (mkdir ~/Downloads). The script defaults to ~ if missing.
  • Network Errors: Check internet (ping api.imgur.com). For DNS issues, try nameserver 8.8.8.8 in /etc/resolv.conf.
  • Invalid Client ID: If HTTP 401 errors occur, get a new Imgur Client ID.
  • Clipboard Issues: Ensure an image is copied (right-click > Copy Image). Install xclip on Linux if needed.
  • GUI Errors: Install Tkinter (sudo apt-get install python3-tk).

About

QuickImgur is a Python tool to upload images to Imgur and copy Markdown links to the clipboard. It supports pasting images from the clipboard, selecting files from any directory, or automatically uploading new images saved to specific directory by default Downloads.

Topics

Resources

Stars

Watchers

Forks

Languages