slint-ui/slint · error

The image cannot be rendered

Error message

The image cannot be rendered

What it means

In the software (CPU) renderer's draw_image path, after the static-texture fast path and an unreachable NineSlice arm, the fallback rasterizes via image_inner.render_to_buffer(svg_target_size). If that returns None — the image variant has no CPU-renderable buffer, e.g. a default/invalid image from a failed load, or an SVG without SVG rasterization support compiled in — the code hits `unimplemented!("The image cannot be rendered")` and panics during rendering.

Source

Thrown at internal/renderers/software/lib.rs:2485

                                        buf_size.height / orig.height,
                                    )
                                    .round()
                                    .cast(),
                            ),
                        },
                        colorize: (colorize.alpha() > 0).then_some(colorize),
                        alpha,
                        dst_x: target_rect.origin.x as _,
                        dst_y: target_rect.origin.y as _,
                        dst_width: target_rect.size.width as _,
                        dst_height: target_rect.size.height as _,
                        rotation: self.rotation.orientation,
                        tiling,
                    };

                    self.processor.process_target_texture(&t, clipped_target.cast());
                } else {
                    unimplemented!("The image cannot be rendered")
                }
            }
        };
    }

    fn draw_text_paragraph<Font>(
        &mut self,
        paragraph: &TextParagraphLayout<'_, Font>,
        physical_clip: euclid::Rect<f32, PhysicalPx>,
        offset: euclid::Vector2D<f32, PhysicalPx>,
        color: Color,
        selection: Option<SelectionInfo>,
    ) where
        Font: AbstractFont
            + i_slint_core::textlayout::TextShaper<Length = PhysicalLength>
            + GlyphRenderer,
    {
        let slint_context = self.window.context();

View on GitHub (pinned to a9ea814a58)

Solutions

  1. Check that every @image-url path resolves at runtime and the files are shipped with the app.
  2. Enable the needed cargo features of i-slint-core (image-formats for the formats you use, SVG support for .svg assets).
  3. Convert assets to broadly supported formats (e.g. PNG) at build time instead of relying on exotic decoders.
  4. If a valid, supported image still triggers the panic, capture the ImageInner variant (e.g. via debugger) and report upstream.

Example fix

# before (Cargo.toml)
i-slint-core = { version = "...", default-features = false, features = ["renderer-software"] }
# .slint references an .svg -> panic: The image cannot be rendered

# after
i-slint-core = { version = "...", default-features = false, features = [
    "renderer-software",
    "image-formats",   # enables decoders incl. SVG path used by the software renderer
] }
Defensive patterns

Strategy: validation

Validate before calling

// Fail fast at startup: verify every image referenced by the assets actually loads
use i_slint_core::graphics::Image;
for path in ["assets/logo.svg", "assets/bg.png"] {
    assert!(Image::load_from_path(std::path::Path::new(path)).is_ok(),
        "image asset missing or unsupported: {path}");
}

Prevention

When it happens

Trigger: Drawing an Image with the software renderer where the underlying image could not be turned into pixels: bad @image-url path / missing resource, an image format not enabled in the build, or an SVG when SVG support (image decoding features of i-slint-core) is absent — typically on embedded targets using renderer-software.

Common situations: Embedded build missing the image-formats/svg cargo features; image file not packaged at the path referenced by the .slint; assets renamed but markup not updated; desktop test build with a stripped-down feature set.

Related errors


AI-assisted analysis of slint-ui/slint@a9ea814a58 (2026-08-16). Data as JSON: /api/errors/57252f90afdfff63. Report an issue: GitHub.