patcolour
Partial color processing for visual-novel style artwork.
patcolour keeps selected regions in color while the rest becomes monochrome. It is meant
to sit between raw photo editing and the larger skirts-colour production pipeline, and to
be callable from other tools that need stable image-processing behavior.
Why patcolour?
The target use case is not generic "selective color" photography. The real goal is more specific: keep emotionally important parts in color while the rest falls back to memory-like grayscale. That makes mask quality, edge softness, and region selection workflow more important than a huge option surface.
Just as importantly, this tool is expected to become reusable infrastructure for other repos,
including name-name-based skirts-colour workflows and future image-processing utilities.
Install
uv tool install patcolour
Or from source:
git clone https://github.com/kako-jun/patcolour.git
cd patcolour
uv sync --group dev
uv run patcolour --help
Usage
Mask-based
patcolour photo.jpg --mask mask.png -o output.png
White areas in the mask stay in color. Black areas become monochrome.
Coordinate-based
patcolour photo.jpg \
--rect 120,40,220,180 \
--ellipse 540,260,110,80 \
--feather 12 \
-o output.png
Auto-detect colorful regions
patcolour photo.jpg --auto-detect -o output.png
Sample a target color from the image
patcolour photo.jpg --sample 420,180 --lab-radius 16 -o output.png
This mode samples one pixel from the input and keeps nearby colors using Lab chroma distance, which is a better fit than raw RGB distance for "keep this hue family" workflows.
Keep only the front flower, not every similar color in the scene
patcolour photo.jpg \
--sample 420,180 \
--lab-radius 16 \
--ellipse 420,180,90,120 \
--feather 10 \
-o output.png
Color alone is not enough for many scenes. In practice, the user often needs to combine a color sample with a spatial guide.
Batch processing
patcolour ./photos/ --mask-dir ./masks/ -o ./output/
Current behavior
--maskuses an external grayscale mask--rectand--ellipsedefine keep-color regions--auto-detectkeeps broad HSV-detected colorful areas--samplekeeps colors near a sampled reference point in Lab chroma space--feathersoftens coordinate-based region edges
The CLI is the first interface, but not the only intended interface. The filter logic should stay predictable enough to be reused from other tools.
Just as importantly, this is a human-guided tool. If the scene contains several similar purples, reds, or greens with different semantic roles, the user must be able to tell the tool which region is the intended subject.
If --auto-detect is combined with coordinate regions, the result is their intersection.
Limitations
- Auto-detection is currently tuned for broad colorful regions and is easy to over-select
- There is no semantic selection yet such as "left flower only" or "girl's ribbon only"
- Batch mode currently assumes one mask per file and does not validate coverage quality
Docs
docs/overview.md— positioning, goals, non-goalsdocs/spec.md— CLI and processing behaviordocs/roadmap.md— internal roadmap and quality targetsCLAUDE.md— AI-facing internal guide
Development
uv sync --group dev
uv run ruff check .
uv run pytest
Metadata
Release files for patcolour 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| patcolour-0.1.0.tar.gz | 8.1 kB | Without provenance | Details for patcolour-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patcolour-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for patcolour-0.1.0-py3-none-any.whl |
Total release size: 17.9 kB
Release files / patcolour-0.1.0.tar.gz
| Download URL | patcolour-0.1.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cbad19f7b58d0b86a98a7c9b442b6752e9150135e434c77e3b6f2a938689852
|
|
BLAKE2b-256 checksum How to use checksums |
a99f4735f4038e94a23bd541b8bcb33f904131383ffe0ff7f2bde3b99f99eee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Release files / patcolour-0.1.0-py3-none-any.whl
| Download URL | patcolour-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
504d6b7e8a996726674fa970699cb956a0d1a4ea61aedec23264ac33e46b1889
|
|
BLAKE2b-256 checksum How to use checksums |
2d434b58fa0d8f588a0f0a779a6094e8afaa10c55bb3ed3894aeac72fc5031b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Security for patcolour 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.