color-thief-rs icon indicating copy to clipboard operation
color-thief-rs copied to clipboard

Strange colors output

Open magick93 opened this issue 7 months ago • 1 comments

Hello

Some of the results I'm getting dont seem correct.

For example, I use this red image I get results that dont appear to correspond to the image.

red

This is an example of the code I'm using:

let palette = match color_thief::get_palette(&img_bytes, ColorFormat::Rgb, 10, 2) {
        Ok(colors) => colors,
        Err(e) => {
            // Handle the error explicitly without using `?`
            return Err(anyhow!("Failed to get palette: {}", e));
        }
    };

And this is the json-ized result:

[
  {
    "red": 172,
    "green": 82,
    "blue": 122
  },
  {
    "red": 21,
    "green": 110,
    "blue": 153
  }
]

magick93 avatar Nov 11 '23 00:11 magick93