Skip to content

About

No description or website provided.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Repository files navigation

🖌️ GIMP Quick Selection Brush Suite (Edge-Aware)

License: GPL v3 GIMP Version Platform

An interactive, edge-aware Quick Selection Brush Suite for GIMP 3.0+ bringing the intuitive, natural object selection experience of Photoshop and Affinity Photo directly into GIMP.

Powered by a state-of-the-art 5-Stage Hybrid Pipeline combining Multi-Channel Gradient Mapping, SLIC Superpixel Feature Graphs, Dinic Max-Flow Min-Cut Optimization, and Subpixel Boundary Edge-Snapping (60 FPS, ZERO LAG, <0.005s).


GIMP Quick Selection Brush UI


🔬 The 5-Stage Hybrid Architecture

Brush Stroke
    ↓
1. Multi-Cluster Seed Extraction (K-Means L*a*b*)
    ↓
2. Multi-Channel Gradient Mapping (|∇L|·wL + |∇a|·wa + |∇b|·wb)
    ↓
3. SLIC Superpixel Feature Graph (Spatial × Color × Edge Strength)
    ↓
4. Dinic Max-Flow / Min-Cut Global Optimization (<0.005s, 60 FPS)
    ↓
5. Subpixel Boundary Refinement & Gradient Edge-Snapping
    ↓
High-Precision Selection Mask

✨ Features

  • ⚡ 5-Stage Hybrid Pipeline: Combines regional superpixel graph optimization with subpixel gradient boundary edge-snapping.
  • 🎨 Multi-Channel CIELAB Edge Mapping: Weighted luminance and color gradient energy ($|\nabla L| \times 0.50 + |\nabla a| \times 0.30 + |\nabla b| \times 0.20$) ensures edges in shadow or tone are never missed.
  • ⚡ Zero Lag (60 FPS Interactive Painting): Solves global energy minimization in <0.005s per stroke with silky-smooth cursor responsiveness.
  • 🔍 Viewport Navigation: Smooth mouse-wheel zooming (10% to 1000%) and middle-click/space-drag panning to inspect fine details.
  • 🎨 Custom Selection Overlays: Choose from vibrant preset swatches (Cyan, Red, Green, Amber, Magenta), pick custom colors, and adjust overlay opacity in real-time.
  • 🎛️ Collapsible Advanced Controls: Fine-tune background cutoff strictness, graph smoothness priors, and contrast sensitivity via an expandable panel.
  • ⚡ Instant Apply (<0.15s): High-speed precomputed row assembly applies 4K/8K selections into GIMP's selection buffer with zero UI lag or freezing.
  • ↩ Full Undo & History: Easily step backward through previous brush strokes.

⚙️ The 4 Specialized Hybrid Engines

Engine Ideal For Behavior & Mathematical Prior
⚡ Lazy Snapping (Default) General photos, everyday objects & people Balanced Multi-Modal Graph Cut: Balanced multi-cluster K-Means color model with subpixel edge snapping.
🎯 Contour-Lock Sharp silhouettes, logos, line art & products High-Tension Boundary Clamping: Elevated edge prior ($\lambda = 45$) and tight contrast scaling to rigidly lock to sharp contours with 0 spill.
🌊 Gradient-Adaptive Soft shading, shadows, cloth & smooth gradients Elastic Gradient Prior: Relaxed boundary tension ($\lambda = 18$) allowing the selection to flow naturally across smooth shading and fabric folds.
🖌️ Precision Detail Small objects, thin stems & delicate touchups Compact Micro-Region Cut: Tight expansion radius with strict color gating for selecting fine features without over-expanding.

🚀 Installation

Option 1: Quick Install via Git Clone (Recommended)

Open your terminal or command prompt, navigate to your GIMP 3 plug-ins folder, and clone the repository directly:

🪟 Windows (PowerShell / Command Prompt):

cd "$env:APPDATA\GIMP\3.0\plug-ins"
git clone https://github.com/bunnywaffle/GIMP-Quick-Selection.git

(If using GIMP 3.2, replace 3.0 with 3.2)

🐧 Linux:

cd ~/.config/GIMP/3.0/plug-ins/
git clone https://github.com/bunnywaffle/GIMP-Quick-Selection.git
chmod +x GIMP-Quick-Selection/*.py

🍏 macOS:

cd ~/Library/Application\ Support/GIMP/3.0/plug-ins/
git clone https://github.com/bunnywaffle/GIMP-Quick-Selection.git
chmod +x GIMP-Quick-Selection/*.py

Option 2: Manual Download

  1. Click Code $\to$ Download ZIP on GitHub and extract the archive.
  2. Move the extracted GIMP-Quick-Selection folder into your GIMP 3 plug-ins/ directory:
    • Windows: C:\Users\<YourUsername>\AppData\Roaming\GIMP\3.0\plug-ins\
    • Linux: ~/.config/GIMP/3.0/plug-ins/
    • macOS: ~/Library/Application Support/GIMP/3.0/plug-ins/
  3. (Linux/macOS only) Make the scripts executable:
    chmod +x GIMP-Quick-Selection/*.py
  4. Restart GIMP.

🎮 How to Use

  1. Open an image in GIMP with an active layer.
  2. In the top menu, go to: Select $\to$ Quick Selection Brush (Edge-Aware)...
  3. Paint over the subject you want to select:
    • Add Mode (+): Drag the brush over your subject. The selection automatically expands to the edges.
    • Subtract Mode (-): Paint over any unwanted areas to erase them from the selection.
    • New / Replace: Clears the previous mask and starts a fresh selection.
  4. Switch Algorithms as needed:
    • Use Lazy Snapping for general photos and objects.
    • Switch to Contour-Lock for hard-edged product shots or logos.
    • Switch to Gradient-Adaptive for smooth shading or fabric.
    • Switch to Precision Detail for small items or thin details.
  5. Click Apply Selection to commit the marching ants selection mask to your GIMP image.

⌨️ Shortcuts & Controls

Action Shortcut / Control
Paint / Select Left Click + Drag
Zoom In / Out Mouse Wheel Up / Down
Pan Canvas Middle Click Drag or Spacebar + Left Click Drag
Undo Stroke Click ↩ Undo or press button
Clear Selection Click Clear
Commit Selection Click Apply Selection (or press Enter)
Cancel Dialog Click Cancel (or press Escape)

🔧 Advanced Fine-Tuning

Click the 🔧 Advanced Parameters & Fine Tuning toggle in the right sidebar to access precision adjustments:

  • Hard Background Cutoff ($\Delta E$): Sets the strictness threshold at which diverging colors are permanently excluded from the foreground.
  • Graph Cut Smoothness Prior ($\lambda$): Controls silhouette edge tension. Higher values ensure cleaner silhouettes and eliminate speckling in textured areas.
  • Boundary Contrast Sensitivity ($\sigma$): Controls how sharp a contrast difference must be to form a boundary cut.

📄 License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0) — see the LICENSE file for details.


🤝 Contributing & Feedback

Contributions, feature suggestions, and bug reports are welcome! Feel free to open an issue or submit a Pull Request on GitHub.

About

No description or website provided.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages