Pura-image: pure-Ruby image processing running on ruby.wasm (browser playground) #641
komagata
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi ruby.wasm community,
Wanted to share a project that ended up being a fairly involved ruby.wasm use case: a pure-Ruby image processing library that runs unchanged in a wasm sandbox.
What it is
pura-image — pure-Ruby decoders/encoders for JPEG, PNG, BMP, GIF, TIFF, ICO, and WebP. Originally built so Rails Active Storage could work without
libvips/ImageMagick(the typical install-pain killer for Rails beginners), but the "no C extensions" property turned out to mean it works in ruby.wasm too.Browser playground
komagata.github.io/pura-image
The page boots ruby.wasm and runs
ImageProcessing::Purachains on a generated 400×300 image (or one you drop in). The exact code shown is what you'd put in a Rails Active Storage variant definition — same chain, executed in the browser tab.What might be interesting for this community
ImageProcessing::Pura.source(...).resize_to_limit(...).convert(...).callruns identically in CRuby and in ruby.wasm. No conditional code paths.rbwasm. The build scripts live underdemo/build/if you want to see how the gems get pulled into the wasm bundle.Honest notes
Asking for
If this fits a "Showcase" or example list anywhere in ruby.wasm docs, happy to contribute a PR pointing to it.
— @komagata
Beta Was this translation helpful? Give feedback.
All reactions