mirror of
https://github.com/arabianq/colorgram-rust.git
synced 2026-04-28 06:31:22 +00:00
fix: now colorgram-cli reads file correctly
This commit is contained in:
+3
-3
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user