Skip to content

Commit fa8d1ca

Browse files
committed
Support gigantic source images also in web
1 parent dded16b commit fa8d1ca

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

crates/maps_io_ros/src/image.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ pub fn load_image(path: &Path) -> Result<image::DynamicImage> {
2525
/// Load an image from a bytes stream (e.g. in wasm applications).
2626
/// The image format is guessed automatically.
2727
pub fn load_image_from_bytes(bytes: &[u8]) -> Result<image::DynamicImage> {
28-
let img_io = ImageReader::new(std::io::Cursor::new(bytes))
28+
let mut reader = ImageReader::new(std::io::Cursor::new(bytes))
2929
.with_guessed_format()
3030
.map_err(|e| Error::io("Cannot create image reader from bytes", e))?;
3131

32-
let img = img_io
32+
reader.no_limits();
33+
let img = reader
3334
.decode()
3435
.map_err(|e| Error::image("Cannot decode image from bytes", e))?;
3536

0 commit comments

Comments
 (0)