Skip to main content

Classical CV-based image leveling and thumbnail generator.

Project description

PlumbKing 👑 — Classical CV Image Leveling & Thumbnails

king

PlumbKing is a lightweight, classical-CV horizon leveling and thumbnail generator. It processes photo batches using a purely deterministic pipeline:

  • Multi-scale K-Means segmentation
  • Canny edge extraction
  • Probabilistic Hough transform
  • Weighted roll voting
  • Optional RANSAC horizon correction

No ML models, no cloud calls — just fast, transparent image geometry.


✨ Features

  • 📐 Automatic roll leveling (multi-scale classical CV)
  • 🔍 Preview mode with confirmation before replacing originals
  • 🧭 EXIF-aware rotation correction
  • 🖼️ Structured thumbnail generation
  • 🛠️ Debug output for each stage (--debug-dir)
  • 🐧 Works on Linux, macOS, WSL

🚀 Installation

pip install plumbking

📦 Basic Usage

Level and thumbnail all images in a directory:

plumbking --directory /path/to/images

Dry-run (no writes):

plumbking --directory /path/to/images --dry-run

Enable full CV debug logging:

plumbking --directory /photos --debug-dir /tmp/pk-debug

This creates per-image folders containing:

  • segmentation maps
  • Canny edge maps
  • Hough overlays
  • RANSAC boundary maps
  • intermediate resized crops

🔧 Workflow Summary

  1. Scan the directory

  2. Detect leveling candidates

  3. Generate preview leveled images under _leveled_preview/

  4. Prompt for approval

    • Yes → originals replaced by leveled versions
    • No → preview removed, originals kept
  5. Generate missing thumbnails


⚙️ Environment Variables

Variable Default Meaning
THUMB_MAX_SIZE 720 Max width/height of thumbnails
LEVELED_PREVIEW_DIR _leveled_preview Directory used for preview leveling
LEVEL_ANALYSIS_SIZE 720 Downscale used during leveling analysis
LEVEL_DEBUG_DIR (unset) Optional global debug directory (overridden by --debug-dir)

📝 Notes

  • Works best for horizon-bearing photos, architecture, landscapes
  • Deterministic classical CV — great for reproducible pipelines
  • Safe to rerun; naming conventions prevent double-processing
  • Designed for large photo collections and batch workflows

One hand for the ship, one hand for the soul. Built aboard Moonshot.

     :=.:***.       .    .*   ==:            .*.                 ....          ...               
     .=.  :         =    .+   =-:            .*.                       ..        .               
     .=.   -        .=    :.  ==:....        .*.                                                 
     .+:   ..        *   .:.= -=:.           .*.                                                 
  .*+:+:    +     --:=+:=***-.:+-:           .*................     . ..  .   ...                
      ++=+:..+.==*+*+-#*++**=****.           .*.                                                 
-::..:-=++*********+*%%##%##:#**+             *:                                                 
::.......:.::.. .:-=+%@*. .+  =-:.           .*-                                       ..        
   -**=#*#*:::....   .  .  -.:+-+-:*****+*++=:=-                                                 
               . .===##-::.........      .    .+                       ......                    
         ..                   .:+-. =-:..... :+#+                                 ......:-=+****#
         ..                         ..   .  -:%:+..-+*****=*+##*=#%# ##%@@@@@@*@@@%%%#@@@@@@@%@@@
....:......       .             .   :.   . .. . .  .:  ###*#*+**+-#:  :-%%   ::.- .=*: .*#= ..:=*
++**+++++*+**##**##@%%%##*.   +%%%%%%%%%%%%%% :+#*=-+= =+-:++ :%*-=: - ==#.+:+=*#-=+:=**%@%@%#**%
==*+*##*+*+*+++++**#%%%#-+:   =##%%%%%%%@%%**:++-==:-...   ..... :+     -%##**:*#*#=:*#+++++++*%%
##+%%%@#@@*@@@@. @@%#+@=%*+@%-##%@%-=*@@#+*%--++*#       *##***=    +%* #%%%@%-@@%%+*+%+*+=+#+%@%
%%#@@%@%*@*@@@@+-%@%#*@%*  @%-%%#@%%:+@@%*#%#####       +*#####+     %* #%@@@#:@@@%##*#.:-:::..-%
#*+#@@@@:@-@@@@@ #@%#-@%+  @@+*- @@%+*@@%-#-                       - =-  *%%%#:%%+=***-*******##%
%+-@@%@@+@+%@%@@#+@.#+@@*  =@*#..@@+=*@%@##@%@%%%%%#%%%#*##*##**+*++ -  -+*#%#=%%--.+-*+++***++=+
.  +@@@@%@@#%%@@@=%..=@@+. .@++#=@@***@@@#*%%%%**#%%%%%###%#####+*+= .   **#**-*#.+==**********=*
.  .@@@@@@@@%%@@@+@-.+@@#*::@*##:+-%%%@@@+#%%##*%%%%%%*=#*+-:+#*=-.     -*#++*.####*-############
.   %@@@@@@@@%@@#-@*-%@@#+:.@+-+-=#***+.                                * ...... .=*=############
+:.-%@@@@+@#@*@@+:%*-%@@++.-@*-#-=@      =**+++++++++.   -.            =          .#*############
-...+@@@@+@##:@@#.#%-%*@=#: @+:-.     =*****+=--. -                   #=.........  =++***********
:.  :@@@@@@##-@@+:#%+#+@=%**@.                                       ==....        .-:::::::----=
*:  .@@@@@@@#+%@#:*%++%%+:+*         .=-++                          :*............ ..::..........
#=   @@@@@@@#+#@@%%#-:%%%= .      .                                .: ... ....      .:::::::::..:
@=   #%%@@@@@%%@@%*=+: -       **=.                        .      ::............    .-------:::::
%+=. *%%%%%%%%%%%%%@%##       .--.                     ..        +*-..................===----::--
%**: *%%%%%%%%#%%%%%=  #     :                    :-:         -==##...... ............=====------
%#+--+%%%%%%%%#%%%%@%% =. -:               .-==--:          -=+-:*................. ..:=====-----
@%=.-*%%%%%%%%%%%@@@@*  .        ..-=====---:.          .**+=-     ....................=----::::-
%%***#%%%%%%%%%@@@@# ::     **++==-=====-           +%##+.        -   ............... .--::-:::::
%%###*%%%%%%%@@@@@*      =*%%@@#+++=-.        .=#%%#-    :     =  .................... .    :.   
%%###*#%%%%%@@@@@@@##** .:@@%@@@@+.     .:.:*%%#.       .++=     ...................  ..    :... 
####**#%%%%%@@@@@@@@@%%@@@@@%@@@@@@-   -*#*-            -+-.     .................... ...   ..=. 
####**#%%@@@@@@@@@@@@%@@@@@##@@@@@%%#*-           -+=   : +. :   ....................:  -=- .:++ 
####*##%%%%@@@@@@@@@@@@@@%%%%%%%%+.            =****: . =-=  -:  .....................  ... .=++ 
##%##*##%%@@@@@@@%%%%%%%%%%%#:               =*#*#.     -+:  .= .*%##**:............ .  :...  ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plumbking-0.1.0.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plumbking-0.1.0-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file plumbking-0.1.0.tar.gz.

File metadata

  • Download URL: plumbking-0.1.0.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for plumbking-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a14112c3ca973819884949288add9b17c0aba0957a6064ca4688639eb3b3fcae
MD5 f2862c713bc2a6ae9f6154f8e1e34a29
BLAKE2b-256 7833a86c6657acae2f76b57ca501d9d2fc47792e63e0492fca3f6980607f225f

See more details on using hashes here.

File details

Details for the file plumbking-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: plumbking-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for plumbking-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9be32f7350417f9f1b8ad252428b5ee70714c6c097bea1b1f11a5fb05f2cda66
MD5 5f3adf520ef843af73f7cb05e0a8406b
BLAKE2b-256 fefe3e0ed3c6164f5f471033b9bf0efe2e104f59daa5e95223b3992c0c4e86f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page