Skip to content

Commit

Permalink
Fix rgba bug when resizing (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamjamjon authored Jul 23, 2024
1 parent 7740761 commit 9a730cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "usls"
version = "0.0.5"
version = "0.0.6"
edition = "2021"
description = "A Rust library integrated with ONNXRuntime, providing a collection of ML models."
repository = "https://github.com/jamjamjon/usls"
Expand Down Expand Up @@ -38,7 +38,7 @@ walkdir = { version = "2.5.0" }
tokenizers = { version = "0.15.2" }
rayon = "1.10.0"
indicatif = "0.17.8"
image = "0.25.1"
image = "0.25.2"
imageproc = { version = "0.24" }
ab_glyph = "0.2.23"
geo = "0.28.0"
Expand Down
2 changes: 1 addition & 1 deletion src/core/dataloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl DataLoader {
}

pub fn try_read<P: AsRef<Path>>(path: P) -> Result<DynamicImage> {
let img = image::io::Reader::open(&path)
let img = image::ImageReader::open(&path)
.map_err(|_| anyhow!("Failed to open image at {:?}", path.as_ref()))?
.decode()
.map_err(|_| anyhow!("Failed to decode image at {:?}", path.as_ref()))?
Expand Down
4 changes: 2 additions & 2 deletions src/core/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl Ops<'_> {
let (mut resizer, options) = Self::build_resizer_filter(filter)?;
for (idx, x) in xs.iter().enumerate() {
let buffer = if x.dimensions() == (width, height) {
x.to_rgba8().into_raw()
x.to_rgb8().into_raw()
} else {
let mut dst_image = Image::new(width, height, PixelType::U8x3);
resizer.resize(x, &mut dst_image, &options)?;
Expand Down Expand Up @@ -251,7 +251,7 @@ impl Ops<'_> {
for (idx, x) in xs.iter().enumerate() {
let (w0, h0) = x.dimensions();
let buffer = if w0 == width && h0 == height {
x.to_rgba8().into_raw()
x.to_rgb8().into_raw()
} else {
let (w, h) = match resize_by {
"auto" => {
Expand Down

0 comments on commit 9a730cc

Please sign in to comment.