SIGN IN SIGN UP

Adjust image color quantization to better match colors and use a more realistic palette (#388)

* imaging: match pixels against the colors the panel really shows

The encoder picks a palette entry for each pixel by nearest neighbor in RGB,
and it placed those entries at the nominal 0/85/170/255 the two GColor8 bits
imply. This is not representative of the actual screen behavior,
especially around saturation.

This adds 64 colors measured off a Pebble Time 2 under sunlight, color
corrected with a SpyderChekr color grid, and adjusts the
nearest neighbor search and Floyd-Steinberg residual to compute against
them.

The measured colors are normalized so the panel's own black and white land on
0 and 255, as the actual contrast is significantly (~5x) lower under sunlight.

The wire format is untouched: palette bytes are still GColor8 codes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: ave <git@ave.zone>

* imaging: choose the palette in the same space it is matched in

Pixels are currently bucketed by rounding each color channel to
0/85/170/255 independently, and a box is represented by averaging those
2-bit components. This is not representative of how they appear to the
eye.

This changes that to bucket by nearest screen color instead, and measure box extents in that space too. A box is now represented by the entry nearest its count-weighted centroid.

This helps to reduce the washed-out look alongside the palette changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: ave <git@ave.zone>

---------

Signed-off-by: ave <git@ave.zone>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A
ave committed
796b9a44f943f26a62dfd5e26fb5c3c0f98eaefc
Parent: 4da1231
Committed by GitHub <noreply@github.com> on 9/23/2026, 1:17:21 PM