diff --git a/server/src/messages/handler.rs b/server/src/messages/handler.rs index d0d1fe5..1153286 100644 --- a/server/src/messages/handler.rs +++ b/server/src/messages/handler.rs @@ -135,7 +135,7 @@ pub fn handle_client(mut stream: TcpStream) -> io::Result<()> { } }; - let img_path: String = match get_file_path("tondaronla", dir_path_buf, get_extension_str(FileExtension::PNG)) { + let img_path: String = match get_file_path("test-23_02_23", dir_path_buf, get_extension_str(FileExtension::PNG)) { Ok(img_path) => img_path, Err(e) => { error!("Error getting file path: {:?}", e); diff --git a/shared/src/utils/image.rs b/shared/src/utils/image.rs index 736c5c1..6b05f50 100644 --- a/shared/src/utils/image.rs +++ b/shared/src/utils/image.rs @@ -13,9 +13,8 @@ pub fn image_from_pixel_intensity(pixel_intensity: Vec) -> Resul let resolution = Resolution::new(width, height); let mut img = ImageBuffer::new(resolution.nx.into(), resolution.ny.into()); for (i, pixel_intensity) in pixel_intensity.iter().enumerate() { - let x = (i % 250 as usize) as u32; - let y = (i / 250 as usize) as u32; - + let x = (i as u32) % resolution.nx as u32; + let y = (i as u32) / resolution.nx as u32; img.put_pixel(x, y, Rgb(color(*pixel_intensity))); }