@pixzle/browser 0.1.6 → 0.1.8
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/dist/{block.d.ts → image-buffer.d.ts} +12 -0
- package/dist/{block.js → image-buffer.js} +28 -10
- package/dist/image-buffer.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +15 -39
- package/dist/index.js.map +1 -1
- package/dist/restorer.d.ts +6 -7
- package/dist/restorer.js +61 -41
- package/dist/restorer.js.map +1 -1
- package/package.json +5 -3
- package/dist/block.js.map +0 -1
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
* Split an image (HTMLImageElement or ImageBitmap) into blocks
|
|
3
3
|
*/
|
|
4
4
|
export declare function splitImageToBlocks(image: HTMLImageElement | ImageBitmap, blockSize: number): Uint8Array[];
|
|
5
|
+
/**
|
|
6
|
+
* Extract a raw RGBA buffer from an image
|
|
7
|
+
*/
|
|
8
|
+
export declare function imageToImageBuffer(image: HTMLImageElement | ImageBitmap): {
|
|
9
|
+
buffer: Uint8Array;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Create an ImageBitmap from a raw RGBA buffer
|
|
15
|
+
*/
|
|
16
|
+
export declare function imageBufferToImageBitmap(buffer: Uint8Array, width: number, height: number): Promise<ImageBitmap>;
|
|
5
17
|
/**
|
|
6
18
|
* Create an ImageBitmap from blocks
|
|
7
19
|
*/
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitImageToBlocks = splitImageToBlocks;
|
|
4
|
+
exports.imageToImageBuffer = imageToImageBuffer;
|
|
5
|
+
exports.imageBufferToImageBitmap = imageBufferToImageBitmap;
|
|
4
6
|
exports.blocksToImageBitmap = blocksToImageBitmap;
|
|
5
7
|
exports.blocksPerImage = blocksPerImage;
|
|
6
8
|
const core_1 = require("@pixzle/core");
|
|
7
|
-
|
|
8
|
-
* Split an image (HTMLImageElement or ImageBitmap) into blocks
|
|
9
|
-
*/
|
|
10
|
-
function splitImageToBlocks(image, blockSize) {
|
|
9
|
+
function drawImageToBuffer(image) {
|
|
11
10
|
const width = image instanceof HTMLImageElement ? image.naturalWidth : image.width;
|
|
12
11
|
const height = image instanceof HTMLImageElement ? image.naturalHeight : image.height;
|
|
13
12
|
const canvas = document.createElement("canvas");
|
|
@@ -18,13 +17,32 @@ function splitImageToBlocks(image, blockSize) {
|
|
|
18
17
|
throw new Error("Could not get 2D context");
|
|
19
18
|
ctx.drawImage(image, 0, 0);
|
|
20
19
|
const imageData = ctx.getImageData(0, 0, width, height);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
return {
|
|
21
|
+
buffer: new Uint8Array(imageData.data.buffer, imageData.data.byteOffset, imageData.data.byteLength),
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Split an image (HTMLImageElement or ImageBitmap) into blocks
|
|
28
|
+
*/
|
|
29
|
+
function splitImageToBlocks(image, blockSize) {
|
|
30
|
+
const { buffer, width, height } = drawImageToBuffer(image);
|
|
26
31
|
return (0, core_1.splitImageToBlocks)(buffer, width, height, blockSize);
|
|
27
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract a raw RGBA buffer from an image
|
|
35
|
+
*/
|
|
36
|
+
function imageToImageBuffer(image) {
|
|
37
|
+
return drawImageToBuffer(image);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create an ImageBitmap from a raw RGBA buffer
|
|
41
|
+
*/
|
|
42
|
+
async function imageBufferToImageBitmap(buffer, width, height) {
|
|
43
|
+
const imageData = new ImageData(new Uint8ClampedArray(buffer.buffer, buffer.byteOffset, buffer.byteLength), width, height);
|
|
44
|
+
return createImageBitmap(imageData);
|
|
45
|
+
}
|
|
28
46
|
/**
|
|
29
47
|
* Create an ImageBitmap from blocks
|
|
30
48
|
*/
|
|
@@ -63,4 +81,4 @@ function blocksPerImage(allBlocks, fragmentBlocksCount, seed, processFunc) {
|
|
|
63
81
|
}
|
|
64
82
|
return processedBlocks.slice(0, globalOffset);
|
|
65
83
|
}
|
|
66
|
-
//# sourceMappingURL=
|
|
84
|
+
//# sourceMappingURL=image-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-buffer.js","sourceRoot":"","sources":["../src/image-buffer.ts"],"names":[],"mappings":";;AAsCA,gDAMC;AAKD,gDAMC;AAKD,4DAgBC;AAKD,kDAoBC;AAUD,wCA6BC;AA5ID,uCAGsB;AAEtB,SAAS,iBAAiB,CAAC,KAAqC;IAK9D,MAAM,KAAK,GACT,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACvE,MAAM,MAAM,GACV,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAEzE,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAEtD,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAExD,OAAO;QACL,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B,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,SAAuB,EACvB,mBAA6B,EAC7B,IAAqB,EACrB,WAA0E;IAE1E,yFAAyF;IACzF,MAAM,eAAe,GAAiB,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClE,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE,CAAC;QAC7C,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAEjD,+EAA+E;QAC/E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,eAAe,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,YAAY,IAAI,SAAS,CAAC,MAAM,CAAC;QAEjC,MAAM,IAAI,UAAU,CAAC;IACvB,CAAC;IAED,0EAA0E;IAC1E,IAAI,YAAY,KAAK,eAAe,CAAC,MAAM,EAAE,CAAC;QAC5C,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ImageInfo, type ManifestData } from "@pixzle/core";
|
|
2
2
|
import { ImageRestorer, type ImageSource } from "./restorer";
|
|
3
3
|
export { ImageRestorer, type ImageSource };
|
|
4
4
|
export interface BrowserRestoreOptions {
|
|
@@ -8,6 +8,8 @@ export interface BrowserRestoreOptions {
|
|
|
8
8
|
manifest?: string;
|
|
9
9
|
/** Manifest data object (alternative to manifest) */
|
|
10
10
|
manifestData?: ManifestData;
|
|
11
|
+
/** Fetch options to use when fetching resources (images, manifest) */
|
|
12
|
+
fetchOptions?: RequestInit;
|
|
11
13
|
}
|
|
12
14
|
export interface BrowserRestoreImageOptions {
|
|
13
15
|
/** Image source - URL, Blob, HTMLImageElement, or ImageBitmap */
|
|
@@ -18,19 +20,23 @@ export interface BrowserRestoreImageOptions {
|
|
|
18
20
|
seed: number;
|
|
19
21
|
/** Information about the original image (dimensions) */
|
|
20
22
|
imageInfo: ImageInfo;
|
|
23
|
+
/** Fetch options to use when fetching resources */
|
|
24
|
+
fetchOptions?: RequestInit;
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Fetch JSON from a URL
|
|
24
28
|
* @param url The URL to fetch JSON from
|
|
29
|
+
* @param fetchOptions Optional fetch options
|
|
25
30
|
* @returns Promise resolving to the parsed JSON
|
|
26
31
|
*/
|
|
27
|
-
export declare function fetchJson<T>(url: string): Promise<T>;
|
|
32
|
+
export declare function fetchJson<T>(url: string, fetchOptions?: RequestInit): Promise<T>;
|
|
28
33
|
/**
|
|
29
34
|
* Fetch manifest data from a URL
|
|
30
35
|
* @param url The URL to fetch manifest from
|
|
36
|
+
* @param fetchOptions Optional fetch options
|
|
31
37
|
* @returns Promise resolving to ManifestData
|
|
32
38
|
*/
|
|
33
|
-
export declare function fetchManifest(url: string): Promise<ManifestData>;
|
|
39
|
+
export declare function fetchManifest(url: string, fetchOptions?: RequestInit): Promise<ManifestData>;
|
|
34
40
|
declare function restore(options: BrowserRestoreOptions): Promise<ImageBitmap[]>;
|
|
35
41
|
declare function restoreImage(options: BrowserRestoreImageOptions): Promise<ImageBitmap>;
|
|
36
42
|
declare const pixzle: {
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ImageRestorer = void 0;
|
|
4
4
|
exports.fetchJson = fetchJson;
|
|
5
5
|
exports.fetchManifest = fetchManifest;
|
|
6
|
+
const core_1 = require("@pixzle/core");
|
|
6
7
|
const restorer_1 = require("./restorer");
|
|
7
8
|
Object.defineProperty(exports, "ImageRestorer", { enumerable: true, get: function () { return restorer_1.ImageRestorer; } });
|
|
8
9
|
/**
|
|
9
10
|
* Fetch JSON from a URL
|
|
10
11
|
* @param url The URL to fetch JSON from
|
|
12
|
+
* @param fetchOptions Optional fetch options
|
|
11
13
|
* @returns Promise resolving to the parsed JSON
|
|
12
14
|
*/
|
|
13
|
-
async function fetchJson(url) {
|
|
14
|
-
const response = await fetch(url);
|
|
15
|
+
async function fetchJson(url, fetchOptions) {
|
|
16
|
+
const response = await fetch(url, fetchOptions);
|
|
15
17
|
if (!response.ok) {
|
|
16
18
|
throw new Error(`Failed to fetch: ${response.status} ${response.statusText}`);
|
|
17
19
|
}
|
|
@@ -20,38 +22,31 @@ async function fetchJson(url) {
|
|
|
20
22
|
/**
|
|
21
23
|
* Fetch manifest data from a URL
|
|
22
24
|
* @param url The URL to fetch manifest from
|
|
25
|
+
* @param fetchOptions Optional fetch options
|
|
23
26
|
* @returns Promise resolving to ManifestData
|
|
24
27
|
*/
|
|
25
|
-
async function fetchManifest(url) {
|
|
26
|
-
return fetchJson(url);
|
|
27
|
-
}
|
|
28
|
-
function validateFragmentImageCount(fragmentImages, manifest) {
|
|
29
|
-
const manifestImageCount = manifest.images.length;
|
|
30
|
-
const fragmentImageCount = fragmentImages.length;
|
|
31
|
-
if (manifestImageCount !== fragmentImageCount) {
|
|
32
|
-
throw new Error(`Fragment image count mismatch: expected ${manifestImageCount} but got ${fragmentImageCount}`);
|
|
33
|
-
}
|
|
28
|
+
async function fetchManifest(url, fetchOptions) {
|
|
29
|
+
return fetchJson(url, fetchOptions);
|
|
34
30
|
}
|
|
35
31
|
async function restore(options) {
|
|
36
|
-
const { images, manifest: manifestSource, manifestData, } = validateRestoreOptions(options);
|
|
32
|
+
const { images, manifest: manifestSource, manifestData, fetchOptions, } = validateRestoreOptions(options);
|
|
37
33
|
let manifest;
|
|
38
34
|
if (manifestData) {
|
|
39
35
|
manifest = manifestData;
|
|
40
36
|
}
|
|
41
37
|
else if (manifestSource) {
|
|
42
|
-
manifest = await fetchManifest(manifestSource);
|
|
38
|
+
manifest = await fetchManifest(manifestSource, fetchOptions);
|
|
43
39
|
}
|
|
44
40
|
else {
|
|
45
41
|
throw new Error("Manifest not provided");
|
|
46
42
|
}
|
|
47
|
-
validateFragmentImageCount(images, manifest);
|
|
48
43
|
const restorer = new restorer_1.ImageRestorer();
|
|
49
|
-
return await restorer.restoreImages(images, manifest);
|
|
44
|
+
return await restorer.restoreImages(images, manifest, fetchOptions);
|
|
50
45
|
}
|
|
51
46
|
async function restoreImage(options) {
|
|
52
|
-
const { image, blockSize, seed, imageInfo } = validateRestoreImageOptions(options);
|
|
47
|
+
const { image, blockSize, seed, imageInfo, fetchOptions } = validateRestoreImageOptions(options);
|
|
53
48
|
const restorer = new restorer_1.ImageRestorer();
|
|
54
|
-
return await restorer.restoreImage(image, blockSize, seed, imageInfo);
|
|
49
|
+
return await restorer.restoreImage(image, blockSize, seed, imageInfo, fetchOptions);
|
|
55
50
|
}
|
|
56
51
|
const pixzle = {
|
|
57
52
|
restore,
|
|
@@ -59,31 +54,12 @@ const pixzle = {
|
|
|
59
54
|
};
|
|
60
55
|
exports.default = pixzle;
|
|
61
56
|
function validateRestoreOptions(options) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const { images, manifest, manifestData } = options;
|
|
65
|
-
if (!images || !Array.isArray(images) || images.length === 0)
|
|
66
|
-
throw new Error("[restore] images must be a non-empty array.");
|
|
67
|
-
if (!manifest && !manifestData)
|
|
68
|
-
throw new Error("[restore] Either manifest or manifestData is required.");
|
|
69
|
-
if (manifest && typeof manifest !== "string")
|
|
70
|
-
throw new Error("[restore] manifest must be a string.");
|
|
57
|
+
(0, core_1.validateOptionsWithImages)(options, "restore");
|
|
58
|
+
(0, core_1.validateManifestOptions)(options, "restore");
|
|
71
59
|
return options;
|
|
72
60
|
}
|
|
73
61
|
function validateRestoreImageOptions(options) {
|
|
74
|
-
|
|
75
|
-
throw new Error("[restoreImage] Options object is required.");
|
|
76
|
-
const { image, blockSize, seed, imageInfo } = options;
|
|
77
|
-
if (!image)
|
|
78
|
-
throw new Error("[restoreImage] image is required.");
|
|
79
|
-
if (typeof blockSize !== "number" || blockSize <= 0)
|
|
80
|
-
throw new Error("[restoreImage] blockSize must be a positive number.");
|
|
81
|
-
if (typeof seed !== "number")
|
|
82
|
-
throw new Error("[restoreImage] seed must be a number.");
|
|
83
|
-
if (!imageInfo ||
|
|
84
|
-
typeof imageInfo.w !== "number" ||
|
|
85
|
-
typeof imageInfo.h !== "number")
|
|
86
|
-
throw new Error("[restoreImage] imageInfo with valid w and h is required.");
|
|
62
|
+
(0, core_1.validateRestoreImageOptions)(options, "restoreImage");
|
|
87
63
|
return options;
|
|
88
64
|
}
|
|
89
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAyCA,8BAWC;AAQD,sCAKC;AAjED,uCAMsB;AACtB,yCAA6D;AAEpD,8FAFA,wBAAa,OAEA;AA0BtB;;;;;GAKG;AACI,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,YAA0B;IAE1B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,oBAAoB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAC7D,CAAC;IACJ,CAAC;IACD,O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,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,IAAA,8BAAuB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,2BAA2B,CAAC,OAAmC;IACtE,IAAA,kCAA+B,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/restorer.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class ImageRestorer {
|
|
|
7
7
|
* @param manifest The manifest data containing restoration information
|
|
8
8
|
* @returns Promise resolving to an array of restored ImageBitmaps
|
|
9
9
|
*/
|
|
10
|
-
restoreImages(fragments: ImageSource[], manifest: ManifestData): Promise<ImageBitmap[]>;
|
|
10
|
+
restoreImages(fragments: ImageSource[], manifest: ManifestData, fetchOptions?: RequestInit): Promise<ImageBitmap[]>;
|
|
11
11
|
/**
|
|
12
12
|
* Restore a single image from a shuffled source
|
|
13
13
|
* @param imageSource The shuffled image (URL, Blob, HTMLImageElement, or ImageBitmap)
|
|
@@ -16,10 +16,9 @@ export declare class ImageRestorer {
|
|
|
16
16
|
* @param imageInfo Information about the original image (dimensions)
|
|
17
17
|
* @returns Promise resolving to the restored ImageBitmap
|
|
18
18
|
*/
|
|
19
|
-
restoreImage(imageSource: ImageSource, blockSize: number, seed: number, imageInfo: ImageInfo): Promise<ImageBitmap>;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private _reconstructImages;
|
|
19
|
+
restoreImage(imageSource: ImageSource, blockSize: number, seed: number, imageInfo: ImageInfo, fetchOptions?: RequestInit): Promise<ImageBitmap>;
|
|
20
|
+
private restoreEachImage;
|
|
21
|
+
private loadImageSource;
|
|
22
|
+
private loadImageBufferFromSource;
|
|
23
|
+
private yieldToMainThread;
|
|
25
24
|
}
|
package/dist/restorer.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ImageRestorer = void 0;
|
|
4
4
|
const core_1 = require("@pixzle/core");
|
|
5
|
-
const
|
|
6
|
-
const block_1 = require("./block");
|
|
5
|
+
const image_buffer_1 = require("./image-buffer");
|
|
7
6
|
class ImageRestorer {
|
|
8
7
|
/**
|
|
9
8
|
* Restore multiple images from shuffled fragments
|
|
@@ -11,12 +10,24 @@ class ImageRestorer {
|
|
|
11
10
|
* @param manifest The manifest data containing restoration information
|
|
12
11
|
* @returns Promise resolving to an array of restored ImageBitmaps
|
|
13
12
|
*/
|
|
14
|
-
async restoreImages(fragments, manifest) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
async restoreImages(fragments, manifest, fetchOptions) {
|
|
14
|
+
(0, core_1.validateFragmentImageCount)(fragments, manifest);
|
|
15
|
+
if (!manifest.config.crossImageShuffle) {
|
|
16
|
+
return await this.restoreEachImage(fragments, manifest, fetchOptions);
|
|
17
|
+
}
|
|
18
|
+
const fragmentImages = await Promise.all(fragments.map(async (fragment) => {
|
|
19
|
+
return await this.loadImageBufferFromSource(fragment, fetchOptions);
|
|
20
|
+
}));
|
|
21
|
+
const restoredBuffers = (0, core_1.restoreImageBuffers)(fragmentImages, manifest);
|
|
22
|
+
fragmentImages.length = 0;
|
|
23
|
+
const restoredImages = [];
|
|
24
|
+
for (let index = 0; index < restoredBuffers.length; index++) {
|
|
25
|
+
const restoredBuffer = restoredBuffers[index];
|
|
26
|
+
restoredImages.push(await (0, image_buffer_1.imageBufferToImageBitmap)(restoredBuffer, manifest.images[index].w, manifest.images[index].h));
|
|
27
|
+
restoredBuffers[index] = new Uint8Array(0);
|
|
28
|
+
await this.yieldToMainThread();
|
|
29
|
+
}
|
|
30
|
+
return restoredImages;
|
|
20
31
|
}
|
|
21
32
|
/**
|
|
22
33
|
* Restore a single image from a shuffled source
|
|
@@ -26,12 +37,22 @@ class ImageRestorer {
|
|
|
26
37
|
* @param imageInfo Information about the original image (dimensions)
|
|
27
38
|
* @returns Promise resolving to the restored ImageBitmap
|
|
28
39
|
*/
|
|
29
|
-
async restoreImage(imageSource, blockSize, seed, imageInfo) {
|
|
40
|
+
async restoreImage(imageSource, blockSize, seed, imageInfo, fetchOptions) {
|
|
30
41
|
const manifest = (0, core_1.createSingleImageManifest)({ blockSize, seed, imageInfo });
|
|
31
|
-
const [restoredImage] = await this.restoreImages([imageSource], manifest);
|
|
42
|
+
const [restoredImage] = await this.restoreImages([imageSource], manifest, fetchOptions);
|
|
32
43
|
return restoredImage;
|
|
33
44
|
}
|
|
34
|
-
async
|
|
45
|
+
async restoreEachImage(fragments, manifest, fetchOptions) {
|
|
46
|
+
const restoredImages = [];
|
|
47
|
+
for (let index = 0; index < fragments.length; index++) {
|
|
48
|
+
const fragment = await this.loadImageBufferFromSource(fragments[index], fetchOptions);
|
|
49
|
+
const restoredBuffer = (0, core_1.restoreSingleImageBuffer)(fragment, manifest.config, manifest.images[index]);
|
|
50
|
+
restoredImages.push(await (0, image_buffer_1.imageBufferToImageBitmap)(restoredBuffer, manifest.images[index].w, manifest.images[index].h));
|
|
51
|
+
await this.yieldToMainThread();
|
|
52
|
+
}
|
|
53
|
+
return restoredImages;
|
|
54
|
+
}
|
|
55
|
+
async loadImageSource(sourceInput, fetchOptions) {
|
|
35
56
|
let source = sourceInput;
|
|
36
57
|
if (typeof URL !== "undefined" && source instanceof URL) {
|
|
37
58
|
source = source.toString();
|
|
@@ -41,8 +62,20 @@ class ImageRestorer {
|
|
|
41
62
|
if (source.complete)
|
|
42
63
|
return source;
|
|
43
64
|
await new Promise((resolve, reject) => {
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
const handleLoad = () => {
|
|
66
|
+
cleanup();
|
|
67
|
+
resolve();
|
|
68
|
+
};
|
|
69
|
+
const handleError = () => {
|
|
70
|
+
cleanup();
|
|
71
|
+
reject(new Error("Failed to load image"));
|
|
72
|
+
};
|
|
73
|
+
const cleanup = () => {
|
|
74
|
+
source.removeEventListener("load", handleLoad);
|
|
75
|
+
source.removeEventListener("error", handleError);
|
|
76
|
+
};
|
|
77
|
+
source.addEventListener("load", handleLoad, { once: true });
|
|
78
|
+
source.addEventListener("error", handleError, { once: true });
|
|
46
79
|
});
|
|
47
80
|
return source;
|
|
48
81
|
}
|
|
@@ -53,7 +86,7 @@ class ImageRestorer {
|
|
|
53
86
|
return createImageBitmap(source);
|
|
54
87
|
}
|
|
55
88
|
if (typeof source === "string") {
|
|
56
|
-
const response = await fetch(source);
|
|
89
|
+
const response = await fetch(source, fetchOptions);
|
|
57
90
|
if (!response.ok) {
|
|
58
91
|
throw new Error(`Failed to fetch image: ${response.status} ${response.statusText}`);
|
|
59
92
|
}
|
|
@@ -62,34 +95,21 @@ class ImageRestorer {
|
|
|
62
95
|
}
|
|
63
96
|
throw new Error("Unsupported image source");
|
|
64
97
|
}
|
|
65
|
-
async
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return { blocks, blockCountsPerImage };
|
|
76
|
-
}
|
|
77
|
-
async _readBlocksFromFragment(fragment, manifest, expectedCount) {
|
|
78
|
-
const image = await this._loadImage(fragment);
|
|
79
|
-
const blocks = (0, block_1.splitImageToBlocks)(image, manifest.config.blockSize);
|
|
80
|
-
return (0, core_1.takeBlocks)(blocks, expectedCount);
|
|
81
|
-
}
|
|
82
|
-
async _readBlocks(fragments, manifest, blockCounts) {
|
|
83
|
-
const blockGroups = await Promise.all(fragments.map((fragment, i) => this._readBlocksFromFragment(fragment, manifest, blockCounts[i])));
|
|
84
|
-
return blockGroups.flat();
|
|
98
|
+
async loadImageBufferFromSource(sourceInput, fetchOptions) {
|
|
99
|
+
const image = await this.loadImageSource(sourceInput, fetchOptions);
|
|
100
|
+
const imageBuffer = (0, image_buffer_1.imageToImageBuffer)(image);
|
|
101
|
+
if (image instanceof ImageBitmap &&
|
|
102
|
+
(typeof sourceInput === "string" ||
|
|
103
|
+
(typeof URL !== "undefined" && sourceInput instanceof URL) ||
|
|
104
|
+
(typeof Blob !== "undefined" && sourceInput instanceof Blob))) {
|
|
105
|
+
image.close();
|
|
106
|
+
}
|
|
107
|
+
return imageBuffer;
|
|
85
108
|
}
|
|
86
|
-
async
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const imageBlocks = blocks.slice(start, end);
|
|
91
|
-
return await (0, block_1.blocksToImageBitmap)(imageBlocks, imageInfo.w, imageInfo.h, manifest.config.blockSize);
|
|
92
|
-
}));
|
|
109
|
+
async yieldToMainThread() {
|
|
110
|
+
await new Promise((resolve) => {
|
|
111
|
+
setTimeout(resolve, 0);
|
|
112
|
+
});
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
exports.ImageRestorer = ImageRestorer;
|
package/dist/restorer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restorer.js","sourceRoot":"","sources":["../src/restorer.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"restorer.js","sourceRoot":"","sources":["../src/restorer.ts"],"names":[],"mappings":";;;AAAA,uCAQsB;AACtB,iDAA8E;AAI9E,MAAa,aAAa;IACxB;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACjB,SAAwB,EACxB,QAAsB,EACtB,YAA0B;QAE1B,IAAA,iCAA0B,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEhD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACvC,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,GAAG,CACtC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAA4B,EAAE;YACzD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CACrC,WAAwB,EACxB,YAA0B;QAE1B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACpE,MAAM,WAAW,GAAG,IAAA,iCAAkB,EAAC,KAAK,CAAC,CAAC;QAE9C,IACE,KAAK,YAAY,WAAW;YAC5B,CAAC,OAAO,WAAW,KAAK,QAAQ;gBAC9B,CAAC,OAAO,GAAG,KAAK,WAAW,IAAI,WAAW,YAAY,GAAG,CAAC;gBAC1D,CAAC,OAAO,IAAI,KAAK,WAAW,IAAI,WAAW,YAAY,IAAI,CAAC,CAAC,EAC/D,CAAC;YACD,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnLD,sCAmLC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixzle/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Browser implementation of image fragmentation and restoration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"directory": "packages/browser"
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20"
|
|
36
|
+
},
|
|
34
37
|
"publishConfig": {
|
|
35
38
|
"access": "public"
|
|
36
39
|
},
|
|
37
40
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@pixzle/core": "0.1.6"
|
|
41
|
+
"@pixzle/core": "0.1.8"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"happy-dom": "^20.0.11",
|
package/dist/block.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":";;AAQA,gDA6BC;AAKD,kDAoBC;AAUD,wCA6BC;AArGD,uCAGsB;AAEtB;;GAEG;AACH,SAAgB,kBAAkB,CAChC,KAAqC,EACrC,SAAiB;IAEjB,MAAM,KAAK,GACT,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACvE,MAAM,MAAM,GACV,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAEzE,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAEtD,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAExD,0DAA0D;IAC1D,+FAA+F;IAC/F,0BAA0B;IAC1B,6CAA6C;IAC7C,MAAM,MAAM,GAAG,IAAI,UAAU,CAC3B,SAAS,CAAC,IAAI,CAAC,MAAM,EACrB,SAAS,CAAC,IAAI,CAAC,UAAU,EACzB,SAAS,CAAC,IAAI,CAAC,UAAU,CAC1B,CAAC;IAEF,OAAO,IAAA,yBA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