fix: now colorgram-cli reads file correctly

This commit is contained in:
2026-01-06 05:25:55 +03:00
parent fdac17eda8
commit d223d85236
+3 -3
View File
@@ -3,6 +3,7 @@ use clap::Parser;
use colorgram::extract; use colorgram::extract;
use std::{ use std::{
error::Error, error::Error,
fs,
path::{PathBuf, absolute}, path::{PathBuf, absolute},
}; };
@@ -31,10 +32,9 @@ fn main() -> Result<(), Box<dyn Error>> {
assert!(input_path.is_file(), "Input path is not a file"); assert!(input_path.is_file(), "Input path is not a file");
assert!(colors_amount > 0, "Colors amount must be greater than zero"); assert!(colors_amount > 0, "Colors amount must be greater than zero");
let img = image::open(input_path)?; let buf = fs::read(input_path)?;
let buf = img.as_bytes();
match extract(buf, colors_amount) { match extract(&buf, colors_amount) {
Ok(colors) => { Ok(colors) => {
for color in colors { for color in colors {
let style = Style::new() let style = Style::new()