- Preprocess the source image by dithering with the full 12-bit //gs
colour palette, ignoring SHR palette restrictions (i.e. each pixel
chosen independently from 4096 colours)
- Using this as the ground truth allows much better handling of
e.g. solid colours, which were being dithered inconsistently with
the previous approach
- Also when fitting an SHR palette, fix any colours that comprise more
than 10% of source pixels. This also encourages more uniformity in
regions of solid colour.
helps with images where there are large solid colour fields that
sometimes cause uneven dithering because of colours that cannot be
matched with the //gs palette, but it's not a viable solution in
general since it reduces overall quality (sometimes substantially,
e.g. in case of vertical colour gradients)
This is useful when used as part of an image repository build
pipeline, to avoid replacing existing images if the new score is
higher.
Hide intermediate output behind --verbose
reserved colours from the global palette, and pick unique random
points from the samples for the rest. This encourages a larger range
of colours in the resulting images and may improve quality.
Iterate a max number of times without improvement in the outer loop as
well.
Save intermediate preview outputs.
- start with an equal split
- with each iteration, pick a palette and adjust its line ranges by a small random amount
- if the proposed palette is accepted, continue to apply the same delta
- if not, revert the adjustment and pick a different one
In addition, often there will be palettes that are entirely unused by
the image. For such palettes:
- find the palette with the largest line range. If > 20, then
subdivide this range and assign half each to both palettes
- if not, then pick a random line range for the unused palette
This helps to refine and explore more of the parameter space.