Skip to content

FRAM-1182 Add opts07 dither option set for 9 color palettes - #64

Draft
jnross wants to merge 2 commits into
joe/bump-base-image-v4-bookwormfrom
joe/opts07-nine-color-palette
Draft

jnross wants to merge 2 commits into
joe/bump-base-image-v4-bookwormfrom
joe/opts07-nine-color-palette

Conversation

@jnross

@jnross jnross commented Sep 16, 2026 •

Copy link
Copy Markdown

Why

First draft of the changes to support passing 9-color calibration data from the frame record through to imgproxy and the dithering algorithm. The new colors are identified in the imgproxy params as or (orange), br (brown), and y2 (yellow2):

eink_10_inch_9colors_chart

This change points the pushd-dither submodule at the current HEAD of the superpixel_dither branch. The submodule pointer may need to be updated if that branch advances or is merged.

This change (or some change supporting 9-color input) must be merged and deployed to imgproxy before we can deploy pushd-web changes to pass that calibration data through in feed URLs: https://github.com/pushd/pushd-web/pull/17661

How I tested it

Build and run the container locally:

docker build -t opts07-test -f docker/Dockerfile .

  docker run -d --name imgproxy-opts07 -p 8080:8080 \
    -e PUSH_S3_IMAGES_BUCKET=dummy -e PUSH_S3_RENDER_BUCKET=dummy \
    -e IMGPROXY_MALLOC=malloc \
    -e IMGPROXY_LOCAL_FILESYSTEM_ROOT=/images \
    -v "$PWD/plugins/pushd-dither/testdata":/images \
    opts07-test

Visit this URL: http://localhost:8080/unsafe/rs:fill:1600:1200/dither:fs:opts07:0.65:bk:17.56:8.58:-11.14:or:36.74:30.54:35.13:y2:63.55:-13.56:40.24:y:60.87:-13.36:64.8:bl:32.23:1.85:-36.16:br:46.48:16.13:46.41:r:25.09:37.85:24.52:g:31:-20.35:8.0:w:63.11:-3.69:-1.47/plain/local:///elephants.png

See this dithered image. Looks good if I adb push it to a frame and use /system/bin/eink-update.sh to refresh the display

elephants_dithered

@jnross
jnross requested review from ericcj, jtomson and tyrfig September 16, 2026 17:13
@notion-workspace

Copy link
Copy Markdown

Comment thread processing/dither.go Outdated
Comment on lines +319 to +324
cmdArgs = append(cmdArgs, "--pal-str", po.Dither.MeasuredPalette)
// Hull is the nine inks themselves. The tool otherwise falls back to
// widening the hull with magenta and cyan, which the nine-ink panel does
// not need; passing the dither palette here leaves it no extras to add.
cmdArgs = append(cmdArgs, "--map-pal-str", po.Dither.MeasuredPalette)
cmdArgs = append(cmdArgs, "--out-pal-str", opts07OutPalette)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to fix this in test.py itself

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, maybe like this? https://github.com/pushd/pushd-dither/pull/52

And then with imgproxy changes 22382f2.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool ya - now imgproxy just passes a wider --pal-str. and can drop --map-pal-str, --out-pal-str, and opts07OutPalette?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. imgproxy changes are minimal and it moves the work into pushd-dither

The 10" panel measures 9 colors, but opts06 slices exactly 24 palette tokens,
so a wider palette was truncated there and the leftover tokens then failed to
parse. opts07 carries all 9 as name:L:a:b, adding or (orange), br (brownish 2)
and y2 (softer yellow 2) to the Spectra 6.

All nine inks are dithered. pushd-dither puts the six base pigments in
canonical slots, keeps the extras after them, and dithers the whole palette, so
adopting opts07 changes what the 10" panel renders.

The gamut hull is set explicitly to those nine inks with --map-pal-str. Left to
itself the tool widens the hull with magenta and cyan, which its README advises
against for a 9+ colour palette.

--out-pal-str carries the panel's drive values, which is what the frame matches
the rendered image against. The tool's built-in out palette holds six colors;
nine ink indices overflow it and it falls back to rendering the measured inks,
which the frame has nothing to match.

opts07 is a fixed 9 colors and rejects a 6 color palette; six and 18 sample
calibration files stay on opts06. Its length check requires all 39 args rather
than repeating the off by one in opts06, which admits a short palette and then
panics on the slice.

The submodule moves to superpixel_dither for the N-colour --pal-str parser that
opts07 depends on. The commit pinned before it accepts six colours only.

Assisted by Claude Opus 5
@jnross
jnross force-pushed the joe/opts07-nine-color-palette branch from 22382f2 to d94af8e Compare September 17, 2026 01:00
@jnross
jnross changed the base branch from master to joe/bump-base-image-v4-bookworm September 17, 2026 01:01
@jnross
jnross added this pull request to stack #66 September 17, 2026 01:01
@jnross
jnross force-pushed the joe/opts07-nine-color-palette branch from d94af8e to 64fe49f Compare September 17, 2026 01:55
opts07 passed --map-pal-str and --out-pal-str to correct two of the dither
tool's defaults for a nine ink palette: it appended magenta and cyan to the
gamut hull whatever the palette's width, and rendered --image-out against a six
colour palette that nine ink indices overflow. Both defaults now key off the
palette's width inside the tool, so the option set carries neither flag, nor a
copy of the panel's drive values.

With those gone the opts07 branch was identical to opts06 and they now share
one. opts07 stays a separate option set because it parses a 36 token palette
where opts06 slices 24.

Rendering is unchanged: the tool-side defaults produce a pixel identical image
to the explicit flags.

Assisted by Claude Opus 5
@jnross
jnross force-pushed the joe/opts07-nine-color-palette branch from 64fe49f to 84c9aec Compare September 17, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants