Module zeng

Module zeng 

Source
Expand description

Zeng Palette Reordering.

Reorders palette indices to improve LZW compression by ensuring visually similar colors have adjacent indices.

Functionsยง

reorder_palette
Reorders the palette using a greedy TSP approximation. Returns (new_palette, index_mapping) where index_mapping[old_idx] = new_idx.