GitHub Image Resizer

Convert GitHub markdown image uploads to HTML <img> tags with customizable width; supports drag-drop, paste, and attachment button uploads.

Author
miked49er
Daily installs
0
Total installs
0
Ratings
0 0 0
Version
1.3
Created
2025-06-11
Updated
2025-06-11
Size
4.73 KB
License
MIT
Applies to

📐 Tampermonkey GitHub Image Resizer

A Tampermonkey userscript that automatically converts uploaded image Markdown in GitHub Pull Requests into an HTML <img> tag with a customizable width.

This tool supports all GitHub image upload methods — including drag-and-drop, paste, and the attachment button — and ensures consistent visual layout for embedded images.


🚀 Features

  • 🖼️ Automatically converts this:

    ![alt text](https://github.com/user-attachments/assets/...)
    

    into:

    <img src="https://github.com/user-attachments/assets/..." alt="alt text" width="300">
    
  • ✅ Supports all image upload methods:

    • Drag-and-drop from desktop 💾
    • Clipboard paste 📋
    • Attachment button 📎
  • 🔁 Converts image Markdown to HTML <img> on-the-fly — no need to manually edit it.

  • ⚙️ Customizable width via Tampermonkey menu

  • 🧠 Intelligent detection even when GitHub silently updates the comment box after uploads


🧩 Installation

  1. Install Tampermonkey:

  2. Install the script:

    • From GreasyFork
    • Or manually:
    • Click the Tampermonkey icon → "Create a new script"
    • Paste contents of github-pr-image-to-html.user.js
    • Save

🛠 How to Set Custom Image Width

  1. Click the Tampermonkey icon in your browser.
  2. Open the menu for "GitHub PR Image to HTML (Custom Width)".
  3. Click "Set Image Width".
  4. Enter a value (e.g. 400) to apply that width (in pixels) to all converted images.

Your setting is stored and applied persistently across sessions.


🔒 Privacy

  • ✅ The script only runs on https://github.com/*
  • ❌ It does not send or store any data externally
  • ✅ Your preferences are stored locally in Tampermonkey

📤 Contributing

Pull requests are welcomed for:

  • Additional customizations (e.g. height, class, max-width)
  • Theme-aware image styling
  • Integration with GitHub Markdown preview styling

📄 License

MIT License — see LICENSE


🧪 Example

Before Upload:

Oredered Listocat

After Upload (Automatically):

Ordered Listocat