Skip to content

Commit

Permalink
Merge pull request #22 from loiccoyle/fix_#14
Browse files Browse the repository at this point in the history
fix weird color issue (#14)
  • Loading branch information
Gabriel Fontes authored Jan 14, 2021
2 parents 5c059e3 + 7652b60 commit 22d4e7f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/operations/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ pub fn generate(
to_stdout: bool,
) -> Result<()> {
let img_buffer = image::open(image_path)?;
let img_pixels = img_buffer
.as_flat_samples_u8()
.ok_or_else(|| anyhow!("Couldn't read provided file. Is it a valid image?"))?;
let img_pixels = img_buffer.to_rgba8().into_raw();
let generated_colors =
color_thief::get_palette(img_pixels.as_slice(), color_thief::ColorFormat::Rgb, 1, 15)?;
color_thief::get_palette(img_pixels.as_slice(), color_thief::ColorFormat::Rgba, 1, 15)?;

let mut colors: Vec<Rgb> = Vec::new();

Expand Down

0 comments on commit 22d4e7f

Please sign in to comment.