+
Skip to content

Roseate fast_downsampling broken with RGBA images. #67

@THEGOLDENPRO

Description

@THEGOLDENPRO

Zune image is panicking when it get's the u8 pixels from self.apply_modifications. The panic states that zune-image expected much more pixels. I'm certain this has to do with fast_downsampling not handling has_alpha correctly as when self.apply_modifications and self.modify_decoded_image is not executed we don't get this panic, with that said to test this you will need this rgba image and zune-image backend enabled by setting misc.experimental.use_fast_roseate_backend to true.

[2025-05-12T20:40:41Z INFO  roseate::notifier] Preparing to load image...
[2025-05-12T20:40:41Z INFO  roseate::notifier] Gathering necessary image modifications...
[2025-05-12T20:40:41Z DEBUG roseate::image_handler] Image is significantly bigger than system's display monitor so monitor downsampling will be applied...
[2025-05-12T20:40:41Z DEBUG roseate::image_handler] Image Size: 4928 x 3279
[2025-05-12T20:40:41Z DEBUG roseate::image_handler] Display (Monitor) Size: 1920 x 1080
[2025-05-12T20:40:41Z DEBUG roseate::image_handler] Display + Monitor Downsample Marginal Allowance (130): 2496 x 1404
[2025-05-12T20:40:41Z DEBUG roseate::image_handler] Loading image in main thread...
[2025-05-12T20:40:41Z INFO  roseate::notifier] Loading image...
[2025-05-12T20:40:41Z DEBUG roseate::image::image] Opening file into buf reader to prepare for reading...
[2025-05-12T20:40:41Z DEBUG roseate::image::image] Decoding image using zune-image decoder...
[2025-05-12T20:40:41Z DEBUG roseate::image::modifications] Applying 'Resize((2496, 1404))' modification to image...

thread 'main' panicked at /home/goldy/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zune-image-0.4.15/src/image.rs:399:9:
assertion `left == right` failed: Length mismatch, expected 11841320 but found 8880990 
  left: 8880990
 right: 11841320
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

These are the lines in question:

DecodedImage::ZuneImage(zune_image) => {
let mut pixels = zune_image.flatten_to_u8().into_iter().next()
.ok_or_else(|| Error::FailedToLoadImage(
None,
"zune-image backend failed to get image data. This image may be corrupted!".to_string()
)
)?;
let colour_space = zune_image.colorspace();
let has_alpha = colour_space.has_alpha();
self.apply_modifications(
modifications,
ModificationProcessingMeat::Roseate(
&mut pixels,
&mut actual_image_size,
has_alpha
)
)?;
let (actual_width, actual_height) = actual_image_size;
Ok(
DecodedImage::ZuneImage(
ZuneImage::from_u8(pixels.as_slice(), actual_width as usize, actual_height as usize, colour_space)
)
)
},

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载