Skip to content

Commit

Permalink
Fix panic when decoding certain images for backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
nununoisy committed Jul 22, 2023
1 parent 1dff3d7 commit 2ce95bb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/video_builder/backgrounds/image_bg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ impl ImageBackground {
Ok(i) => i,
Err(_) => return None
};
let img = dyn_img
.as_rgba8()
.expect("Convert image to RGBA");
let img = image::imageops::resize(img, w, h, image::FilterType::Gaussian);
let img = image::imageops::resize(&dyn_img.to_rgba(), w, h, image::imageops::Gaussian);

let mut frame = frame::Video::new(format::Pixel::RGBA, w, h);
frame.data_mut(0).copy_from_slice(&img.into_raw());
Expand Down

0 comments on commit 2ce95bb

Please sign in to comment.