Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
account for stride in thumbnails
Brendan Alland48b0badb0bd
diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rsindex d78821ba5..978281260 100644--- a/crates/export/src/lib.rs+++ b/crates/export/src/lib.rs@@ -262,16 +262,20 @@ where// Save the first frame as a screenshot and thumbnailif let Some(frame) = first_frame {- let rgba_img: ImageBuffer<Rgba<u8>, Vec<u8>> =- ImageBuffer::from_raw(frame.width, frame.height, frame.data)- .expect("Failed to create image from frame data");-- // Convert RGBA to RGB- let rgb_img: ImageBuffer<image::Rgb<u8>, Vec<u8>> =- ImageBuffer::from_fn(frame.width, frame.height, |x, y| {- let rgba = rgba_img.get_pixel(x, y);- image::Rgb([rgba[0], rgba[1], rgba[2]])- });+ let rgb_img = ImageBuffer::<image::Rgb<u8>, Vec<u8>>::from_raw(+ frame.width,+ frame.height,+ frame+ .data+ .chunks(frame.padded_bytes_per_row as usize)+ .flat_map(|row| {+ row[0..(frame.width * 4) as usize]+ .chunks(4)+ .flat_map(|chunk| [chunk[0], chunk[1], chunk[2]])+ })+ .collect::<Vec<_>>(),+ )+ .expect("Failed to create image from frame data");let screenshots_dir = project_path.join("screenshots");std::fs::create_dir_all(&screenshots_dir).unwrap_or_else(|e| {diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rsindex fc4337c7d..3cd77245b 100644--- a/crates/rendering/src/lib.rs+++ b/crates/rendering/src/lib.rs@@ -928,7 +928,6 @@ pub struct RenderedFrame {pub width: u32,pub height: u32,pub padded_bytes_per_row: u32,- pub total_frames: Option<u32>,}pub async fn produce_frame(@@ -1325,7 +1324,6 @@ pub async fn produce_frame(padded_bytes_per_row,width: uniforms.output_size.0,height: uniforms.output_size.1,- total_frames: Some(total_frames),})}