Add color mapping

This commit is contained in:
Schluffe
2026-09-30 23:13:20 +02:00
parent 67fb971175
commit 3b72cd5723
4 changed files with 568 additions and 13 deletions
+29
View File
@@ -29,6 +29,35 @@ cargo run --release -- /path/to/screenshot.png
5. **Save crop PNG** writes a uniquely named PNG in the system temporary directory
and displays its path. Drop an image or click **Open image…** to browse for a file in KDE's file picker.
## Color grouping and mapping
**Group similar colors** is enabled by default in the **Palette**. Nearby shades
from scaling or compression share a row showing their combined percentage and
shade count. Adjust **Tolerance** (default 8, range 0–32) to control the maximum
difference in each RGB channel from the group's most frequent color. Groups do
not chain together through intermediate shades. Turn grouping off or set tolerance
to zero for the exact palette. Hover a row to highlight its pixels in magenta in
the crop preview; this temporary highlight is never exported.
Freeze a capture or import an image, then click **Map** beside a palette row.
In **Color mapping**, click its replacement swatch to choose another color or enter
RGB values. Every original shade in that group maps to the chosen replacement.
Add multiple mappings to try a new palette. Each mapping keeps its original group
members even if you later change tolerance or crop. If a new mapping overlaps an
older one, the new mapping owns those shades; the older mapping keeps any others.
Replacements are simultaneous, so swapping two colors works without cascading.
Alpha is preserved and fully transparent pixels are left untouched.
Toggle **Preview mappings** to compare with the original palette. Remove an
individual mapping with **×** or use **Reset mappings**. Mappings survive crop
changes, pause during live capture, and return when frozen again. Opening a new
image or choosing a new capture source clears them.
Mappings apply before the preview adjustments or vision filter. Source preview,
analysis, copied pixel values, and **Save crop PNG** still use the original.
**Save mapped crop PNG** exports the crop with replacements, preserving alpha
and excluding preview adjustments and filters.
## Color analysis and vision checks
The **Color analysis** tab has four distributions: