From aaeb1b2b35c43d10c92cbb99a604f97821e57854 Mon Sep 17 00:00:00 2001 From: Shunsuke Yoshizawa <63687325+yssy1982@users.noreply.github.com> Date: Sat, 31 Oct 2026 19:37:32 +0900 Subject: [PATCH] Respect SVG image-rendering pixelated attribute --- crates/svg/src/import/importer.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/svg/src/import/importer.rs b/crates/svg/src/import/importer.rs index 2215458e8..c2220f9d8 100644 --- a/crates/svg/src/import/importer.rs +++ b/crates/svg/src/import/importer.rs @@ -652,10 +652,16 @@ impl Importer { if link.is_some() && !missing { blob.with_proxy() } else { blob } }); let xf = acc * Affine::scale_non_uniform(size.width() as f64 / pw as f64, size.height() as f64 / ph as f64); - self.named( + let mut node = self.named( i.id(), NodeKind::Image(Box::new(ImageObject { key, width: pw, height: ph, xf, link, placement: Default::default(), pixels: None })), - ) + )?; + + if i.rendering_mode() == usvg::ImageRendering::Pixelated { + node.extras_mut().pixelated = true; + } + + Some(node) } /// An SVG shown as an image (a data URL or a linked file) → its art, `acc` mapping its size.