@wasmedia/wimagemagick 0.2.0
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/CHANGELOG.md +230 -0
- package/LICENSE +199 -0
- package/README.md +75 -0
- package/dist/api.d.ts +68 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +218 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +71 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +273 -0
- package/dist/cli.js.map +1 -0
- package/dist/filesystem.d.ts +37 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +141 -0
- package/dist/filesystem.js.map +1 -0
- package/dist/image.d.ts +125 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +426 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/licenses/README.txt +11 -0
- package/dist/licenses/aom-LICENSE.txt +28 -0
- package/dist/licenses/brotli-LICENSE.txt +21 -0
- package/dist/licenses/de265-LICENSE.txt +873 -0
- package/dist/licenses/ffi-LICENSE.txt +23 -0
- package/dist/licenses/freetype-LICENSE.txt +171 -0
- package/dist/licenses/glib-LICENSE.txt +504 -0
- package/dist/licenses/heif-LICENSE.txt +873 -0
- package/dist/licenses/highway-LICENSE.txt +203 -0
- package/dist/licenses/imagemagick-LICENSE.txt +106 -0
- package/dist/licenses/imagemagick-NOTICE.txt +240 -0
- package/dist/licenses/jpeg-turbo-LICENSE.txt +137 -0
- package/dist/licenses/jpeg-xl-LICENSE.txt +29 -0
- package/dist/licenses/lcms-LICENSE.txt +24 -0
- package/dist/licenses/libraw-COPYRIGHT.txt +27 -0
- package/dist/licenses/libraw-LICENSE.CDDL.txt +340 -0
- package/dist/licenses/libraw-LICENSE.LGPL.txt +458 -0
- package/dist/licenses/lqr-LICENSE.txt +167 -0
- package/dist/licenses/openjpeg-LICENSE.txt +41 -0
- package/dist/licenses/png-LICENSE.txt +136 -0
- package/dist/licenses/tiff-LICENSE.txt +51 -0
- package/dist/licenses/webp-LICENSE.txt +31 -0
- package/dist/licenses/xml-LICENSE.txt +26 -0
- package/dist/licenses/zlib-LICENSE.txt +24 -0
- package/dist/loader.d.ts +25 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +50 -0
- package/dist/loader.js.map +1 -0
- package/dist/raw.d.ts +39 -0
- package/dist/raw.d.ts.map +1 -0
- package/dist/raw.js +151 -0
- package/dist/raw.js.map +1 -0
- package/dist/types.d.ts +164 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +94 -0
- package/dist/types.js.map +1 -0
- package/dist/wimagemagick.js +15 -0
- package/dist/wimagemagick.wasm +0 -0
- package/dist/worker-handler.d.ts +46 -0
- package/dist/worker-handler.d.ts.map +1 -0
- package/dist/worker-handler.js +165 -0
- package/dist/worker-handler.js.map +1 -0
- package/dist/worker.d.ts +14 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +19 -0
- package/dist/worker.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MEMFS filesystem helpers for managing files in the Emscripten virtual filesystem.
|
|
3
|
+
*/
|
|
4
|
+
let workDirCounter = 0;
|
|
5
|
+
/** Create a unique working directory in MEMFS. */
|
|
6
|
+
export function createWorkDir(module) {
|
|
7
|
+
const dir = `/work_${++workDirCounter}_${Date.now()}`;
|
|
8
|
+
module.FS.mkdir(dir);
|
|
9
|
+
return dir;
|
|
10
|
+
}
|
|
11
|
+
/** Remove a working directory and all its contents. */
|
|
12
|
+
export function cleanWorkDir(module, dir) {
|
|
13
|
+
try {
|
|
14
|
+
const entries = module.FS.readdir(dir);
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
if (entry === "." || entry === "..")
|
|
17
|
+
continue;
|
|
18
|
+
const path = `${dir}/${entry}`;
|
|
19
|
+
try {
|
|
20
|
+
module.FS.unlink(path);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// May be a directory; ignore
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
module.FS.rmdir(dir);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Directory may not exist; ignore
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Write a Uint8Array or ArrayBuffer to a MEMFS path. */
|
|
33
|
+
export function writeToMemFS(module, path, data) {
|
|
34
|
+
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
35
|
+
module.FS.writeFile(path, bytes);
|
|
36
|
+
}
|
|
37
|
+
/** Read a file from MEMFS as Uint8Array. */
|
|
38
|
+
export function readFromMemFS(module, path) {
|
|
39
|
+
return module.FS.readFile(path);
|
|
40
|
+
}
|
|
41
|
+
/** Check if a file exists in MEMFS. */
|
|
42
|
+
export function existsInMemFS(module, path) {
|
|
43
|
+
try {
|
|
44
|
+
module.FS.stat(path);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Remove a file from MEMFS. */
|
|
52
|
+
export function removeFromMemFS(module, path) {
|
|
53
|
+
try {
|
|
54
|
+
module.FS.unlink(path);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// File may not exist; ignore
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Write multiple files to a MEMFS directory. Returns the directory path. */
|
|
61
|
+
export function writeFilesToMemFS(module, dir, files) {
|
|
62
|
+
for (const [name, data] of files) {
|
|
63
|
+
writeToMemFS(module, `${dir}/${name}`, data);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Read all files from a MEMFS directory. Returns a map of filename → data. */
|
|
67
|
+
export function readFilesFromMemFS(module, dir, exclude) {
|
|
68
|
+
const result = new Map();
|
|
69
|
+
try {
|
|
70
|
+
const entries = module.FS.readdir(dir);
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
if (entry === "." || entry === "..")
|
|
73
|
+
continue;
|
|
74
|
+
if (exclude?.has(entry))
|
|
75
|
+
continue;
|
|
76
|
+
const path = `${dir}/${entry}`;
|
|
77
|
+
try {
|
|
78
|
+
const stat = module.FS.stat(path);
|
|
79
|
+
if (module.FS.isFile(stat.mode)) {
|
|
80
|
+
result.set(entry, module.FS.readFile(path));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Skip unreadable entries
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Directory may not exist
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Copy a blob from WASM heap memory to a new Uint8Array.
|
|
95
|
+
* Use this when reading MagickGetImageBlob output.
|
|
96
|
+
*/
|
|
97
|
+
export function copyFromHeap(module, ptr, length) {
|
|
98
|
+
const copy = new Uint8Array(length);
|
|
99
|
+
copy.set(module.HEAPU8.subarray(ptr, ptr + length));
|
|
100
|
+
return copy;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Write data to WASM heap memory, returning the pointer.
|
|
104
|
+
* Caller must free the pointer with module._free().
|
|
105
|
+
*/
|
|
106
|
+
export function copyToHeap(module, data) {
|
|
107
|
+
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
108
|
+
const ptr = module._malloc(bytes.length);
|
|
109
|
+
module.HEAPU8.set(bytes, ptr);
|
|
110
|
+
return ptr;
|
|
111
|
+
}
|
|
112
|
+
/** Convert a Uint8Array to a Blob. */
|
|
113
|
+
export function toBlob(data, mimeType = "application/octet-stream") {
|
|
114
|
+
return new Blob([data], { type: mimeType });
|
|
115
|
+
}
|
|
116
|
+
/** Convert a Uint8Array to a data URL. */
|
|
117
|
+
export function toDataURL(data, mimeType) {
|
|
118
|
+
const binary = Array.from(data)
|
|
119
|
+
.map((b) => String.fromCharCode(b))
|
|
120
|
+
.join("");
|
|
121
|
+
return `data:${mimeType};base64,${btoa(binary)}`;
|
|
122
|
+
}
|
|
123
|
+
/** Map of common format names to MIME types. */
|
|
124
|
+
const FORMAT_MIME_MAP = {
|
|
125
|
+
JPEG: "image/jpeg",
|
|
126
|
+
JPG: "image/jpeg",
|
|
127
|
+
PNG: "image/png",
|
|
128
|
+
WEBP: "image/webp",
|
|
129
|
+
GIF: "image/gif",
|
|
130
|
+
TIFF: "image/tiff",
|
|
131
|
+
BMP: "image/bmp",
|
|
132
|
+
AVIF: "image/avif",
|
|
133
|
+
HEIC: "image/heic",
|
|
134
|
+
JXL: "image/jxl",
|
|
135
|
+
SVG: "image/svg+xml",
|
|
136
|
+
};
|
|
137
|
+
/** Get MIME type for an image format. */
|
|
138
|
+
export function getMimeType(format) {
|
|
139
|
+
return FORMAT_MIME_MAP[format.toUpperCase()] ?? "application/octet-stream";
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB,kDAAkD;AAClD,MAAM,UAAU,aAAa,CAAC,MAAkB;IAC9C,MAAM,GAAG,GAAG,SAAS,EAAE,cAAc,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IACtD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,MAAkB,EAAE,GAAW;IAC1D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvC,KAAK,M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,eAAe,GAA2B;IAC9C,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,eAAe;CACrB,CAAC;AAEF,yCAAyC;AACzC,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,0BAA0B,CAAC;AAC7E,CAAC"}
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level image class with chainable operations.
|
|
3
|
+
*
|
|
4
|
+
* Wraps MagickWand with a friendly API. Each WMagickImage holds a pointer
|
|
5
|
+
* to a MagickWand and must be disposed when done.
|
|
6
|
+
*/
|
|
7
|
+
import type { WasmModule, ImageFormat, ImageInfo } from "./types.js";
|
|
8
|
+
import { FilterType, AlphaChannelOption, CompositeOperator } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Set the shared WASM module for WMagickImage.
|
|
11
|
+
* Called by the loader during initialization.
|
|
12
|
+
*/
|
|
13
|
+
export declare function setSharedModule(module: WasmModule): void;
|
|
14
|
+
export declare class WMagickImage {
|
|
15
|
+
private _wand;
|
|
16
|
+
private _disposed;
|
|
17
|
+
private constructor();
|
|
18
|
+
/** Get the underlying MagickWand pointer (for advanced use). */
|
|
19
|
+
get wand(): number;
|
|
20
|
+
private ensureAlive;
|
|
21
|
+
/**
|
|
22
|
+
* Create a WMagickImage from a Uint8Array or ArrayBuffer.
|
|
23
|
+
*
|
|
24
|
+
* @param data - The encoded image
|
|
25
|
+
* @param format - Format to read the data as, e.g. `'DNG'` or `'ARW'`.
|
|
26
|
+
* Only the raw camera formats need it: their coder is registered with
|
|
27
|
+
* `ExplicitFormatType` and does not accept blobs, so ImageMagick will not
|
|
28
|
+
* reach LibRaw from a buffer alone. When omitted, the raw formats
|
|
29
|
+
* {@link detectRawFormat} recognises (CR2, CR3, NEF, DNG, 3FR, IIQ) are
|
|
30
|
+
* supplied automatically; pass it for any other raw.
|
|
31
|
+
*/
|
|
32
|
+
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: string): WMagickImage;
|
|
33
|
+
/**
|
|
34
|
+
* Read a buffer through MEMFS with an explicit `FORMAT:path` specifier,
|
|
35
|
+
* which is the only route to the coders that do not support blobs.
|
|
36
|
+
*/
|
|
37
|
+
private static fromBufferAs;
|
|
38
|
+
/**
|
|
39
|
+
* Create a WMagickImage from a Blob.
|
|
40
|
+
*
|
|
41
|
+
* @param format - See {@link WMagickImage.fromBuffer}.
|
|
42
|
+
*/
|
|
43
|
+
static fromBlob(blob: Blob, format?: string): Promise<WMagickImage>;
|
|
44
|
+
/** Create a WMagickImage from a file in MEMFS. */
|
|
45
|
+
static fromFile(path: string): WMagickImage;
|
|
46
|
+
/** Clone this image. */
|
|
47
|
+
clone(): WMagickImage;
|
|
48
|
+
get width(): number;
|
|
49
|
+
get height(): number;
|
|
50
|
+
get format(): string;
|
|
51
|
+
get depth(): number;
|
|
52
|
+
get colorspace(): number;
|
|
53
|
+
get compressionQuality(): number;
|
|
54
|
+
/** Get basic image info without needing to query individual properties. */
|
|
55
|
+
get info(): ImageInfo;
|
|
56
|
+
/** Resize the image using the specified filter. */
|
|
57
|
+
resize(width: number, height: number, filter?: FilterType): this;
|
|
58
|
+
/**
|
|
59
|
+
* Shrink the image to fit within `maxWidth` x `maxHeight`, keeping its
|
|
60
|
+
* aspect ratio — ImageMagick's `-resize WxH>`. An image that already fits
|
|
61
|
+
* is left alone; nothing is ever enlarged.
|
|
62
|
+
*/
|
|
63
|
+
fit(maxWidth: number, maxHeight: number, filter?: FilterType): this;
|
|
64
|
+
/** Resize using adaptive interpolation (good for shrinking). */
|
|
65
|
+
adaptiveResize(width: number, height: number): this;
|
|
66
|
+
/** Create a thumbnail (fast resize). */
|
|
67
|
+
thumbnail(width: number, height: number): this;
|
|
68
|
+
/** Crop a region from the image. */
|
|
69
|
+
crop(width: number, height: number, x?: number, y?: number): this;
|
|
70
|
+
/** Extend the image canvas. */
|
|
71
|
+
extent(width: number, height: number, x?: number, y?: number): this;
|
|
72
|
+
/** Rotate the image by the specified degrees. */
|
|
73
|
+
rotate(degrees: number): this;
|
|
74
|
+
/** Flip the image vertically. */
|
|
75
|
+
flip(): this;
|
|
76
|
+
/** Flop the image horizontally. */
|
|
77
|
+
flop(): this;
|
|
78
|
+
/** Transpose the image (flip + rotate 270°). */
|
|
79
|
+
transpose(): this;
|
|
80
|
+
/** Transverse the image (flop + rotate 270°). */
|
|
81
|
+
transverse(): this;
|
|
82
|
+
/** Apply a blur filter. */
|
|
83
|
+
blur(radius: number, sigma: number): this;
|
|
84
|
+
/** Apply a Gaussian blur. */
|
|
85
|
+
gaussianBlur(radius: number, sigma: number): this;
|
|
86
|
+
/** Sharpen the image. */
|
|
87
|
+
sharpen(radius: number, sigma: number): this;
|
|
88
|
+
/** Apply unsharp mask. */
|
|
89
|
+
unsharpMask(radius: number, sigma: number, gain: number, threshold: number): this;
|
|
90
|
+
/** Composite another image onto this one. */
|
|
91
|
+
composite(other: WMagickImage, operator?: CompositeOperator, x?: number, y?: number): this;
|
|
92
|
+
/** Set the output compression quality (0-100). */
|
|
93
|
+
quality(value: number): this;
|
|
94
|
+
/** Set the output format. */
|
|
95
|
+
setFormat(format: ImageFormat): this;
|
|
96
|
+
/** Strip metadata (EXIF, profiles, comments). */
|
|
97
|
+
strip(): this;
|
|
98
|
+
/** Auto-orient based on EXIF orientation tag. */
|
|
99
|
+
autoOrient(): this;
|
|
100
|
+
/** Auto-level the image (stretch contrast). */
|
|
101
|
+
autoLevel(): this;
|
|
102
|
+
/** Normalize the image (enhance contrast). */
|
|
103
|
+
normalize(): this;
|
|
104
|
+
/** Deskew the image. */
|
|
105
|
+
deskew(threshold?: number): this;
|
|
106
|
+
/** Set alpha channel operation. */
|
|
107
|
+
alpha(option: AlphaChannelOption): this;
|
|
108
|
+
/** Set image depth (bits per channel). */
|
|
109
|
+
setDepth(depth: number): this;
|
|
110
|
+
/** Set colorspace. */
|
|
111
|
+
setColorspace(colorspace: number): this;
|
|
112
|
+
/** Export the image as a Uint8Array in the specified format. */
|
|
113
|
+
toBuffer(format?: ImageFormat): Uint8Array;
|
|
114
|
+
/** Export the image as a Blob. */
|
|
115
|
+
toBlob(format?: ImageFormat): Blob;
|
|
116
|
+
/** Export the image as a data URL. */
|
|
117
|
+
toDataURL(format?: ImageFormat): string;
|
|
118
|
+
/** Write the image to a MEMFS file path. */
|
|
119
|
+
writeToFile(path: string): void;
|
|
120
|
+
/** Free the underlying MagickWand. Must be called when done. */
|
|
121
|
+
dispose(): void;
|
|
122
|
+
/** Whether this image has been disposed. */
|
|
123
|
+
get isDisposed(): boolean;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAW/E;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAIxD;AA2BD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO;IAIP,gEAAgE;IAChE,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,OAAO,CAAC,WAAW;IAMnB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,UAAU,CACf,IAA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