rust-image-processing
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

About

🚴 Usage

Example using directly as a module in modern browsers

  <script type="module">
    async function loadResizer() {
      const lib = await import('./pkg/rust_image_processing.js')
      await lib.default()
      return lib.resize_image
    }

    async function loadImage() {
      const image = await fetch("sample.png")
      return image.arrayBuffer()
    }

    const resize_image = await loadResizer()

    const buffer = await loadImage()

    const u8buf = new Uint8ClampedArray(buffer)

    const result = resize_image(u8buf, 256, 256)

    const img = document.createElement('img')
    img.src = URL.createObjectURL(new Blob([result.buffer]), { type: "image/jpeg" })
    document.querySelector('body').appendChild(img)
  </script>

🛠️ Build with wasm-pack build

This library is designed for use in web browsers, so building is targetted to web.

wasm-pack build --target web

Readme

Keywords

none

Package Sidebar

Install

npm i rust-image-processing

Weekly Downloads

0

Version

0.1.0

License

none

Unpacked Size

368 kB

Total Files

5

Last publish

Collaborators

  • mfeckie