Skip to content

Explore alternative color quantization algorithms #2681

@sxyazi

Description

@sxyazi

Please describe the problem you're trying to solve

Sixel is an ancient image format that only supports 256 colors. So, when rendering a Sixel image, it is necessary to extract the 256 most representative colors from the image to serve as a palette and map any color in the image to one of these.

Yazi initially selected the neural-network quantization algorithm because it is, to my knowledge, the best in terms of quality among the available quantization algorithms. However, compared to other quantization algorithms, it requires a higher computational load, which is not ideal for low-spec devices.

It would be great to find an algorithm that delivers quality comparable to the neural-network quantization algorithm but is much faster.

Currently, Yazi provides the sixel_fraction configuration for the neural-network quantization algorithm, allowing users to balance between quantization precision and computational cost — that is, users can reduce CPU usage by increasing the sixel_fraction. So, when evaluating other quantization algorithms:

  • The algorithm's quality should be comparable to that of sixel_fraction = 10 (highest quality).
  • The algorithm's speed should be considerably faster than sixel_fraction = 30 (highest speed).

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Additional context

No response

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions