Skip to content

Commit

Permalink
Merge pull request #260 from SalOne22/bugfix/255-convert-f32-to-u8
Browse files Browse the repository at this point in the history
fix(cli): 🐛 fixed handling of float32 images
  • Loading branch information
SalOne22 committed Aug 16, 2024
2 parents 1457ae0 + 66c3648 commit a96f6d1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit a96f6d1

Please sign in to comment.