wasm-image-optimization 1.2.22 → 1.2.24

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
@@ -1,77 +1,45 @@
1
1
  # wasm-image-optimization
2
2
 
3
- ## Supported Environments
3
+ WebAssembly is used to provide image transformation functionality.
4
4
 
5
- - Cloudflare workers
6
- `import { optimizeImage } from 'wasm-image-optimization';`
7
- - Next.js (Webpack)
8
- `import { optimizeImage } from 'wasm-image-optimization/next';`
9
- - ESM (import base) & Deno Deploy
10
- `import { optimizeImage } from 'wasm-image-optimization';`
11
- - Node.js
12
- `import { optimizeImage } from 'wasm-image-optimization';`
13
- - Node.js(Multi thread)
14
- `import { optimizeImage } from 'wasm-image-optimization/node-worker';`
15
- - Vite (Browser)
16
- `import { optimizeImage } from 'wasm-image-optimization/vite';`
17
- - Web Worker (Browser) Multi process
18
- `import { optimizeImage } from 'wasm-image-optimization/web-worker';`
19
-
20
- ## Samples
21
-
22
- https://github.com/SoraKumo001/wasm-image-optimization-samples
5
+ - Frontend
23
6
 
24
- ### cloudflare-ogp
7
+ - Next.js (Multithreading support)
8
+ - React Router (Multithreading support)
25
9
 
26
- Sample for generating OGP images on Cloudflare Workers.
10
+ - Backend
27
11
 
28
- ### deno-ogp
12
+ - Cloudflare Workers
13
+ - Deno Deploy
14
+ - Node.js (Multithreading support)
29
15
 
30
- Sample for generating OGP images on Deno.
16
+ - Convert
17
+ - source format
18
+ - svg
19
+ - jpeg (EXIF orientation is supported)
20
+ - png
21
+ - webp
22
+ - avif
23
+ - output format
24
+ - jpeg
25
+ - png
26
+ - webp
27
+ - avif (default)
31
28
 
32
- ### cloudflare-image-optimization
29
+ ## Example
33
30
 
34
- Sample for image optimization on Cloudflare Workers.
31
+ https://next-image-convert.vercel.app/
32
+ ![](https://raw.githubusercontent.com/node-libraries/wasm-image-optimization/refs/heads/master/doc/image.avif)
35
33
 
36
- ### deno-image-optimization
37
-
38
- Sample for image optimization on Deno.
39
-
40
- ### node-image-convert
41
-
42
- Sample for converting image formats on Node.js.
43
- Single-threaded and multi-threaded operation can be selected.
44
-
45
- ## WebWorker on Vite
46
-
47
- - vite.config.ts
48
-
49
- ```ts
50
- import wasmImageOptimizationPlugin from "wasm-image-optimization/vite-plugin";
51
-
52
- export default defineConfig(() => ({
53
- plugins: [wasmImageOptimizationPlugin()],
54
- }));
55
- ```
56
-
57
- ## Next.js on Backend API
34
+ ## Functions
58
35
 
59
36
  ```ts
60
- import { optimizeImage } from "wasm-image-optimization";
61
-
62
- export const runtime = "edge";
63
- ```
64
-
65
- ## function
66
-
67
- ```ts
68
-
69
37
  optimizeImage({
70
38
  image: ArrayBuffer,
71
39
  width?: number,
72
40
  height?:number,
73
41
  quality?: number, // quality: 1-100
74
- format?: "png" | "jpeg" | "avif" | "webp"}
42
+ format?: "png" | "jpeg" | "avif" | "webp" | "none"}
75
43
  speed?: number // avif-speed: 0-10 (Slow-Fast, default: 6)
76
44
  ):
77
45
  Promise<
@@ -82,26 +50,49 @@ optimizeImageExt({
82
50
  width?: number,
83
51
  height?:number,
84
52
  quality?: number,
85
- format?: "png" | "jpeg" | "avif" | "webp"}
53
+ format?: "png" | "jpeg" | "avif" | "webp" | "none"}
86
54
  speed?: number // avif-speed: 0-10 (Slow-Fast, default: 6)
87
55
  ):
88
56
  Promise<{
89
- data: Uint8Array;
90
- originalWidth: number;
91
- originalHeight: number;
92
- width: number;
93
- height: number;}>
57
+ data: Uint8Array,
58
+ originalWidth: number,
59
+ originalHeight: number,
60
+ width: number,
61
+ height: number}>
62
+
63
+ ```
64
+
65
+ ## WebWorker on Vite
66
+
67
+ To use Vite, the following settings are required
68
+
69
+ - vite.config.ts
94
70
 
71
+ ```ts
72
+ import wasmImageOptimizationPlugin from "wasm-image-optimization/vite-plugin";
73
+
74
+ export default defineConfig(() => ({
75
+ plugins: [wasmImageOptimizationPlugin()],
76
+ }));
95
77
  ```
96
78
 
97
- - source format
98
- - svg
99
- - jpeg(EXIF orientation is supported)
100
- - png
101
- - webp
102
- - avif
103
- - output format
104
- - jpeg
105
- - png
106
- - webp
107
- - avif(default)
79
+ ## Supported Environments
80
+
81
+ - Cloudflare workers
82
+ `import { optimizeImage } from 'wasm-image-optimization';`
83
+ - Next.js (Webpack)
84
+ `import { optimizeImage } from 'wasm-image-optimization/next';`
85
+ - ESM (import base) & Deno Deploy
86
+ `import { optimizeImage } from 'wasm-image-optimization';`
87
+ - Node.js
88
+ `import { optimizeImage } from 'wasm-image-optimization';`
89
+ - Node.js(Multi thread)
90
+ `import { optimizeImage } from 'wasm-image-optimization/node-worker';`
91
+ - Vite (Browser)
92
+ `import { optimizeImage } from 'wasm-image-optimization/vite';`
93
+ - Web Worker (Browser) Multi process
94
+ `import { optimizeImage } from 'wasm-image-optimization/web-worker';`
95
+
96
+ ## Samples
97
+
98
+ https://github.com/SoraKumo001/wasm-image-optimization-samples
@@ -10,6 +10,6 @@ export type OptimizeParams = {
10
10
  width?: number;
11
11
  height?: number;
12
12
  quality?: number;
13
- format?: "jpeg" | "png" | "webp" | "avif";
13
+ format?: "jpeg" | "png" | "webp" | "avif" | "none";
14
14
  speed?: number;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type OptimizeResult = {\n data: Uint8Array;\n originalWidth: number;\n originalHeight: number;\n width: number;\n height: number;\n};\n\nexport type OptimizeParams = {\n image: BufferSource | string; // The input image data\n width?: number; // The desired output width (optional)\n height?: number; // The desired output height (optional)\n quality?: number; // The desired output quality (0-100, optional)\n format?: \"jpeg\" | \"png\" | \"webp\" | \"avif\"; // The desired output format (optional)\n speed?: number; // The desired speed (0-10, Slow-Fast, Optional)\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type OptimizeResult = {\n data: Uint8Array;\n originalWidth: number;\n originalHeight: number;\n width: number;\n height: number;\n};\n\nexport type OptimizeParams = {\n image: BufferSource | string; // The input image data\n width?: number; // The desired output width (optional)\n height?: number; // The desired output height (optional)\n quality?: number; // The desired output quality (0-100, optional)\n format?: \"jpeg\" | \"png\" | \"webp\" | \"avif\" | \"none\"; // The desired output format (optional)\n speed?: number; // The desired speed (0-10, Slow-Fast, Optional)\n};\n"]}
Binary file
@@ -10,6 +10,6 @@ export type OptimizeParams = {
10
10
  width?: number;
11
11
  height?: number;
12
12
  quality?: number;
13
- format?: "jpeg" | "png" | "webp" | "avif";
13
+ format?: "jpeg" | "png" | "webp" | "avif" | "none";
14
14
  speed?: number;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type OptimizeResult = {\n data: Uint8Array;\n originalWidth: number;\n originalHeight: number;\n width: number;\n height: number;\n};\n\nexport type OptimizeParams = {\n image: BufferSource | string; // The input image data\n width?: number; // The desired output width (optional)\n height?: number; // The desired output height (optional)\n quality?: number; // The desired output quality (0-100, optional)\n format?: \"jpeg\" | \"png\" | \"webp\" | \"avif\"; // The desired output format (optional)\n speed?: number; // The desired speed (0-10, Slow-Fast, Optional)\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type OptimizeResult = {\n data: Uint8Array;\n originalWidth: number;\n originalHeight: number;\n width: number;\n height: number;\n};\n\nexport type OptimizeParams = {\n image: BufferSource | string; // The input image data\n width?: number; // The desired output width (optional)\n height?: number; // The desired output height (optional)\n quality?: number; // The desired output quality (0-100, optional)\n format?: \"jpeg\" | \"png\" | \"webp\" | \"avif\" | \"none\"; // The desired output format (optional)\n speed?: number; // The desired speed (0-10, Slow-Fast, Optional)\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wasm-image-optimization",
3
3
  "description": "Optimize images with wasm on edge runtime",
4
- "version": "1.2.22",
4
+ "version": "1.2.24",
5
5
  "scripts": {
6
6
  "test": "yarn ts-node test",
7
7
  "lint:fix": "eslint --fix src/ && prettier -w src",