wasm-image-processor 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,16 +30,18 @@ Try the live demo at: [https://stanleymasinde.github.io/wasm-image-processor/](h
30
30
 
31
31
 
32
32
  ## Installation
33
+ ```shell
34
+ npm i wasm-image-processor
35
+ ```
33
36
 
34
- **Note**: No npm package is available yet. You need to build from source.
37
+ ## Building
35
38
 
36
39
  ### Prerequisites
37
40
 
38
41
  - [Rust](https://rustup.rs/)
39
42
  - [wasm-pack](https://rustwasm.github.io/wasm-pack/)
40
43
 
41
- ### Building
42
-
44
+ ### Steps
43
45
  1. Clone the repository:
44
46
  ```bash
45
47
  git clone https://github.com/yourusername/wasm-image-processor.git
@@ -73,12 +75,12 @@ Include the WASM module in your web page:
73
75
 
74
76
  ```html
75
77
  <script type="module">
76
- import init, { resize_square } from "./pwa_image_generator.js";
78
+ import init, { resize_square } from "pwa_image_generator";
77
79
 
78
80
  init().then(() => {
79
81
  // WASM module is ready
80
82
  const imageData = new Uint8Array(/* your image data */);
81
- const resizedBytes = resize_image(Array.from(imageData), 500);
83
+ const resizedBytes = resize_square(Array.from(imageData), 500);
82
84
 
83
85
  // Use resizedBytes as needed
84
86
  });
@@ -87,7 +89,7 @@ Include the WASM module in your web page:
87
89
 
88
90
  ### API Reference
89
91
 
90
- #### `resize_image(image_data: Vec<u8>, side: u32) -> Vec<u8>`
92
+ #### `resize_square(image_data: Vec<u8>, side: u32) -> Vec<u8>`
91
93
 
92
94
  Resizes an image to a square with the specified side length.
93
95
 
@@ -100,7 +102,7 @@ Resizes an image to a square with the specified side length.
100
102
 
101
103
  **Example:**
102
104
  ```javascript
103
- const resizedBytes = resize_image(imageBytes, 256);
105
+ const resizedBytes = resize_square(imageBytes, 256);
104
106
  const blob = new Blob([new Uint8Array(resizedBytes)], { type: 'image/png' });
105
107
  ```
106
108
 
@@ -117,7 +119,7 @@ wasm-image-processor/
117
119
  │ └── pwa_image_generator_bg.wasm # Generated WASM binary
118
120
  ├── pkg/ # wasm-pack output
119
121
  ├── tests/ # Test files
120
- ├── copy_pkg.sh # Build script
122
+ ├── prep-demo.sh # Copy the build to the demo folder
121
123
  ├── Cargo.toml
122
124
  └── README.md
123
125
  ```
@@ -129,9 +131,6 @@ wasm-image-processor/
129
131
  ```bash
130
132
  # Run Rust tests
131
133
  cargo test
132
-
133
- # Test with sample images
134
- cargo test test_resize_logic --lib
135
134
  ```
136
135
 
137
136
  ### Adding New Features
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Stanley Masinde <hello@stanleymasinde.com>"
6
6
  ],
7
7
  "description": "High-performance client-side image processing toolkit powered by Rust and WebAssembly",
8
- "version": "0.1.0",
8
+ "version": "0.1.1",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
Binary file