Skip to content

opensass/image-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–ΌοΈ Image RS

Crates.io Crates.io Downloads Crates.io License made-with-rust Rust Maintenance

Join our Discord

logo

🎬 Demo

image-rs-demo

Framework Live Demo
Yew Netlify Status
Dioxus TODO
Leptos TODO

πŸ“œ Intro

Image RS is a highly optimized, feature-rich image component built for WASM-based frameworks like Yew, Dioxus, and Leptos. It offers lazy loading, blur-up placeholders, fallback image handling, responsive layouts, and full ARIA accessibility.

πŸ€” Why Use Image RS?

The following features make Image RS a must-have for modern WASM apps:

  1. πŸš€ Performance Optimized: Smart lazy loading with IntersectionObserver and fallback strategies.
  2. 🎨 Advanced Layouts: Responsive, Fill, Intrinsic, Fixed, Stretch, and ScaleDown layouts.
  3. 🧩 Accessibility First: Full ARIA attribute support to build inclusive UIs.
  4. ⚑ Interactive Events: Callbacks for loading completion and error handling.
  5. πŸ–ΌοΈ Visual Enhancements: Blur placeholders and fallback images for seamless loading UX.

Yew Usage

Refer to our guide to integrate this component into your Yew app.

🧬 Dioxus Usage (TODO)

Refer to our guide to integrate this component into your Dioxus app.

🌱 Leptos Usage (TODO)

Refer to our guide to integrate this component into your Leptos app.

πŸ“ˆ Benchmark

  1. Open browser DevTools (Press F12) > Lighthouse tab.
  2. Record page load by clicking "Analyze Page Load".
  3. Observe:
    • First Contentful Paint (FCP)
    • Largest Contentful Paint (LCP)
    • Time to Interactive (TTI)
    • Total network transfer size
    • Memory usage

πŸš€ Summary

Feature Yew Image RS Next.js Image
Native Rust+Wasm βœ… ❌
Built-in Image Optimization βœ… βœ…
SSR/SEO Friendly βœ… βœ…
Fine-grained DOM Control βœ… ❌
Smaller JS Payload βœ… βœ…

πŸ“Š Performance Results

When loading 10 images, Yew Image RS and Next.js Image are on par:

Metric Yew (Wasm) Next.js
Performance Score (Lighthouse) 100 100
Memory Usage (Heap) ~8 MB ~8 MB

However, when scaling up to 10,000 images loaded simultaneously:

Metric Yew (Wasm) Next.js
Performance Score (Lighthouse) 64 ❌ (Lighthouse fails)
Memory Usage (Heap) ~78 MB ~83 MB
Scrolling Smoothness Very Smooth Laggy

Key observations:

  • Wasm (Yew) handles large DOM updates much better than JavaScript.
  • Memory usage is slightly lower with Wasm.
  • Next.js site failed Lighthouse audit at 10,000 images (due to TTI timeout).
  • Smoothness is significantly better with Yew under heavy load.

πŸ› οΈ Future Improvements

  • Image RS is working on automatic image optimization.
  • Progressive loading and lazy hydration strategies are being researched for even better large-scale performance.

🀝 Contributions

Contributions are welcome! Whether it's bug fixes, feature requests, or examples, we would love your help to make Image RS better.

  1. Fork the repository.
  2. Create a new branch for your feature/bugfix.
  3. Submit a pull request for review.

πŸ“œ License

Image RS is licensed under the MIT License. You are free to use, modify, and distribute this library in your projects.