From 66c3648145a78254b325457fbdfd53f5401feb17 Mon Sep 17 00:00:00 2001 From: Vladyslav Vladinov Date: Fri, 16 Aug 2024 15:51:34 +0200 Subject: [PATCH] fix(cli): :bug: fixed handling of float32 images --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b27c181..a8950de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,8 +18,12 @@ use indicatif::{ use indicatif_log_bridge::LogWrapper; use rayon::prelude::*; use rimage::operations::icc::ApplySRGB; -use zune_core::colorspace::ColorSpace; -use zune_image::{core_filters::colorspace::ColorspaceConv, image::Image, pipelines::Pipeline}; +use zune_core::{bit_depth::BitDepth, colorspace::ColorSpace}; +use zune_image::{ + core_filters::{colorspace::ColorspaceConv, depth::Depth}, + image::Image, + pipelines::Pipeline, +}; use zune_imageprocs::auto_orient::AutoOrient; use crate::cli::pipeline::encoder; @@ -135,6 +139,10 @@ fn main() { let mut available_encoder = handle_error!(input, encoder(subcommand, matches)); output.set_extension(available_encoder.to_extension()); + if img.depth() == BitDepth::Float32 { + pipeline.chain_operations(Box::new(Depth::new(BitDepth::Eight))); + } + pipeline.chain_operations(Box::new(AutoOrient)); pipeline.chain_operations(Box::new(ApplySRGB));