@pixzle/node 0.0.15 → 0.0.17
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/cjs/constants.js +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/package.json +2 -2
- package/dist/block.d.ts +0 -70
- package/dist/block.js +0 -149
- package/dist/block.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -3
- package/dist/constants.js.map +0 -1
- package/dist/esm/package.json +0 -53
- package/dist/file.d.ts +0 -32
- package/dist/file.js +0 -47
- package/dist/file.js.map +0 -1
- package/dist/fragmenter.d.ts +0 -13
- package/dist/fragmenter.js +0 -91
- package/dist/fragmenter.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -55
- package/dist/index.js.map +0 -1
- package/dist/package.json +0 -54
- package/dist/restorer.d.ts +0 -9
- package/dist/restorer.js +0 -50
- package/dist/restorer.js.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.js +0 -9
- package/dist/utils.js.map +0 -1
package/dist/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
|
-
const package_json_1 = require("package.json");
|
|
4
|
+
const package_json_1 = require("./../package.json");
|
|
5
5
|
exports.VERSION = package_json_1.version;
|
|
6
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,oDAA4C;AAE/B,QAAA,OAAO,GAAG,sBAAO,CAAC"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixzle/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Node.js implementation of image fragmentation and restoration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@tuki0918/seeded-shuffle": "^1.0.0",
|
|
37
37
|
"jimp": "^1.6.0",
|
|
38
|
-
"@pixzle/core": "0.0.
|
|
38
|
+
"@pixzle/core": "0.0.17"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^22.10.2",
|
package/dist/block.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
interface ImageFileToBlocksResult {
|
|
2
|
-
blocks: Buffer[];
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
channels: number;
|
|
6
|
-
blockCountX: number;
|
|
7
|
-
blockCountY: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Split an RGBA image buffer into an array of blocks (Node.js Buffer wrapper)
|
|
11
|
-
* @param buffer Source image buffer (RGBA format)
|
|
12
|
-
* @param width Image width in pixels
|
|
13
|
-
* @param height Image height in pixels
|
|
14
|
-
* @param blockSize Block size in pixels
|
|
15
|
-
* @returns Array of block buffers
|
|
16
|
-
*/
|
|
17
|
-
export declare function splitImageToBlocks(buffer: Buffer, width: number, height: number, blockSize: number): Buffer[];
|
|
18
|
-
/**
|
|
19
|
-
* Reconstruct an RGBA image buffer from an array of blocks (Node.js Buffer wrapper)
|
|
20
|
-
* @param blocks Array of block buffers
|
|
21
|
-
* @param width Target image width in pixels
|
|
22
|
-
* @param height Target image height in pixels
|
|
23
|
-
* @param blockSize Block size in pixels
|
|
24
|
-
* @returns Reconstructed image buffer
|
|
25
|
-
*/
|
|
26
|
-
export declare function blocksToImageBuffer(blocks: Buffer[], width: number, height: number, blockSize: number): Buffer;
|
|
27
|
-
/**
|
|
28
|
-
* Load an image from file or buffer and split into blocks
|
|
29
|
-
* @param input Path to the image file or Buffer containing image data
|
|
30
|
-
* @param blockSize Block size in pixels
|
|
31
|
-
* @returns Promise resolving to block data and image metadata
|
|
32
|
-
*/
|
|
33
|
-
export declare function imageFileToBlocks(input: string | Buffer, blockSize: number): Promise<ImageFileToBlocksResult>;
|
|
34
|
-
/**
|
|
35
|
-
* Reconstruct a PNG image from blocks
|
|
36
|
-
* @param blocks Array of block buffers
|
|
37
|
-
* @param width Target image width in pixels
|
|
38
|
-
* @param height Target image height in pixels
|
|
39
|
-
* @param blockSize Block size in pixels
|
|
40
|
-
* @returns Promise resolving to PNG buffer
|
|
41
|
-
*/
|
|
42
|
-
export declare function blocksToPngImage(blocks: Buffer[], width: number, height: number, blockSize: number): Promise<Buffer>;
|
|
43
|
-
/**
|
|
44
|
-
* Extract raw RGBA image buffer from a PNG buffer using Jimp
|
|
45
|
-
* @param pngBuffer PNG image buffer
|
|
46
|
-
* @returns Promise resolving to image buffer and image dimensions
|
|
47
|
-
*/
|
|
48
|
-
export declare function extractImageBufferFromPng(pngBuffer: Buffer): Promise<{
|
|
49
|
-
imageBuffer: Buffer;
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
}>;
|
|
53
|
-
/**
|
|
54
|
-
* Create a PNG buffer from raw RGBA image buffer using Jimp
|
|
55
|
-
* @param imageBuffer Raw RGBA image buffer
|
|
56
|
-
* @param width Image width in pixels
|
|
57
|
-
* @param height Image height in pixels
|
|
58
|
-
* @returns Promise resolving to PNG buffer
|
|
59
|
-
*/
|
|
60
|
-
export declare function createPngFromImageBuffer(imageBuffer: Buffer, width: number, height: number): Promise<Buffer>;
|
|
61
|
-
/**
|
|
62
|
-
* Apply a function to blocks per image
|
|
63
|
-
* @param allBlocks - All blocks to process
|
|
64
|
-
* @param fragmentBlocksCount - Number of blocks per fragment
|
|
65
|
-
* @param seed - Seed for the processing function
|
|
66
|
-
* @param processFunc - Function to apply to blocks (shuffle or unshuffle)
|
|
67
|
-
* @returns Processed blocks
|
|
68
|
-
*/
|
|
69
|
-
export declare function blocksPerImage(allBlocks: Buffer[], fragmentBlocksCount: number[], seed: number | string, processFunc: (blocks: Buffer[], seed: number | string) => Buffer[]): Buffer[];
|
|
70
|
-
export {};
|
package/dist/block.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { RGBA_CHANNELS, calculateBlockCounts, blocksToImageBuffer as coreBlocksToImageBuffer, splitImageToBlocks as coreSplitImageToBlocks, } from "@pixzle/core";
|
|
2
|
-
import { Jimp, JimpMime } from "jimp";
|
|
3
|
-
/**
|
|
4
|
-
* Format error message consistently
|
|
5
|
-
* @param operation Description of the operation that failed
|
|
6
|
-
* @param error The error that occurred
|
|
7
|
-
* @returns Formatted error message
|
|
8
|
-
*/
|
|
9
|
-
function formatErrorMessage(operation, error) {
|
|
10
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
11
|
-
return `${operation}: ${errorMessage}`;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Create a Jimp image from raw RGBA image buffer
|
|
15
|
-
* @param imageBuffer Raw RGBA image buffer
|
|
16
|
-
* @param width Image width in pixels
|
|
17
|
-
* @param height Image height in pixels
|
|
18
|
-
* @returns Jimp image instance
|
|
19
|
-
*/
|
|
20
|
-
function createJimpFromImageBuffer(imageBuffer, width, height) {
|
|
21
|
-
return new Jimp({
|
|
22
|
-
data: imageBuffer,
|
|
23
|
-
width,
|
|
24
|
-
height,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Split an RGBA image buffer into an array of blocks (Node.js Buffer wrapper)
|
|
29
|
-
* @param buffer Source image buffer (RGBA format)
|
|
30
|
-
* @param width Image width in pixels
|
|
31
|
-
* @param height Image height in pixels
|
|
32
|
-
* @param blockSize Block size in pixels
|
|
33
|
-
* @returns Array of block buffers
|
|
34
|
-
*/
|
|
35
|
-
export function splitImageToBlocks(buffer, width, height, blockSize) {
|
|
36
|
-
const blocks = coreSplitImageToBlocks(buffer, width, height, blockSize);
|
|
37
|
-
return blocks.map((block) => Buffer.from(block));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Reconstruct an RGBA image buffer from an array of blocks (Node.js Buffer wrapper)
|
|
41
|
-
* @param blocks Array of block buffers
|
|
42
|
-
* @param width Target image width in pixels
|
|
43
|
-
* @param height Target image height in pixels
|
|
44
|
-
* @param blockSize Block size in pixels
|
|
45
|
-
* @returns Reconstructed image buffer
|
|
46
|
-
*/
|
|
47
|
-
export function blocksToImageBuffer(blocks, width, height, blockSize) {
|
|
48
|
-
const uint8Blocks = blocks.map((block) => new Uint8Array(block));
|
|
49
|
-
const imageBuffer = coreBlocksToImageBuffer(uint8Blocks, width, height, blockSize);
|
|
50
|
-
return Buffer.from(imageBuffer);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Load an image from file or buffer and split into blocks
|
|
54
|
-
* @param input Path to the image file or Buffer containing image data
|
|
55
|
-
* @param blockSize Block size in pixels
|
|
56
|
-
* @returns Promise resolving to block data and image metadata
|
|
57
|
-
*/
|
|
58
|
-
export async function imageFileToBlocks(input, blockSize) {
|
|
59
|
-
try {
|
|
60
|
-
// Load and process image with Jimp (automatically converts to RGBA)
|
|
61
|
-
const image = await Jimp.read(input);
|
|
62
|
-
const { width, height } = image.bitmap;
|
|
63
|
-
const channels = RGBA_CHANNELS;
|
|
64
|
-
const imageBuffer = image.bitmap.data;
|
|
65
|
-
// Split image into blocks
|
|
66
|
-
const blocks = splitImageToBlocks(imageBuffer, width, height, blockSize);
|
|
67
|
-
const blockCounts = calculateBlockCounts(width, height, blockSize);
|
|
68
|
-
return {
|
|
69
|
-
blocks,
|
|
70
|
-
width,
|
|
71
|
-
height,
|
|
72
|
-
channels,
|
|
73
|
-
blockCountX: blockCounts.blockCountX,
|
|
74
|
-
blockCountY: blockCounts.blockCountY,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
throw new Error(`${formatErrorMessage("Failed to process image file", error)}. The manifest file may not match the image data.`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Reconstruct a PNG image from blocks
|
|
83
|
-
* @param blocks Array of block buffers
|
|
84
|
-
* @param width Target image width in pixels
|
|
85
|
-
* @param height Target image height in pixels
|
|
86
|
-
* @param blockSize Block size in pixels
|
|
87
|
-
* @returns Promise resolving to PNG buffer
|
|
88
|
-
*/
|
|
89
|
-
export async function blocksToPngImage(blocks, width, height, blockSize) {
|
|
90
|
-
try {
|
|
91
|
-
const imageBuffer = blocksToImageBuffer(blocks, width, height, blockSize);
|
|
92
|
-
return await createPngFromImageBuffer(imageBuffer, width, height);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
throw new Error(formatErrorMessage("Failed to reconstruct PNG image from blocks", error));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Extract raw RGBA image buffer from a PNG buffer using Jimp
|
|
100
|
-
* @param pngBuffer PNG image buffer
|
|
101
|
-
* @returns Promise resolving to image buffer and image dimensions
|
|
102
|
-
*/
|
|
103
|
-
export async function extractImageBufferFromPng(pngBuffer) {
|
|
104
|
-
try {
|
|
105
|
-
const image = await Jimp.read(pngBuffer);
|
|
106
|
-
const { width, height } = image.bitmap;
|
|
107
|
-
const imageBuffer = Buffer.from(image.bitmap.data);
|
|
108
|
-
return { imageBuffer, width, height };
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
throw new Error(formatErrorMessage("Failed to extract image buffer from PNG", error));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Create a PNG buffer from raw RGBA image buffer using Jimp
|
|
116
|
-
* @param imageBuffer Raw RGBA image buffer
|
|
117
|
-
* @param width Image width in pixels
|
|
118
|
-
* @param height Image height in pixels
|
|
119
|
-
* @returns Promise resolving to PNG buffer
|
|
120
|
-
*/
|
|
121
|
-
export async function createPngFromImageBuffer(imageBuffer, width, height) {
|
|
122
|
-
try {
|
|
123
|
-
const image = createJimpFromImageBuffer(imageBuffer, width, height);
|
|
124
|
-
return await image.getBuffer(JimpMime.png);
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
throw new Error(formatErrorMessage("Failed to create PNG from image buffer", error));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Apply a function to blocks per image
|
|
132
|
-
* @param allBlocks - All blocks to process
|
|
133
|
-
* @param fragmentBlocksCount - Number of blocks per fragment
|
|
134
|
-
* @param seed - Seed for the processing function
|
|
135
|
-
* @param processFunc - Function to apply to blocks (shuffle or unshuffle)
|
|
136
|
-
* @returns Processed blocks
|
|
137
|
-
*/
|
|
138
|
-
export function blocksPerImage(allBlocks, fragmentBlocksCount, seed, processFunc) {
|
|
139
|
-
const processedBlocks = [];
|
|
140
|
-
let offset = 0;
|
|
141
|
-
for (const blockCount of fragmentBlocksCount) {
|
|
142
|
-
const imageBlocks = allBlocks.slice(offset, offset + blockCount);
|
|
143
|
-
const processed = processFunc(imageBlocks, seed);
|
|
144
|
-
processedBlocks.push(...processed);
|
|
145
|
-
offset += blockCount;
|
|
146
|
-
}
|
|
147
|
-
return processedBlocks;
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=block.js.map
|
package/dist/block.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,mBAAmB,IAAI,uBAAuB,EAC9C,kBAAkB,IAAI,sBAAsB,GAC7C,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAWtC;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,SAAiB,EAAE,KAAc;IAC3D,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;IAC9E,OAAO,GAAG,SAAS,KAAK,YAAY,EAAE,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,yBAAyB,CAChC,WAAmB,EACnB,KAAa,EACb,MAAc;IAEd,OAAO,IAAI,IAAI,CAAC;QACd,IAAI,EAAE,WAAW;QACjB,KAAK;QACL,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,KAAa,EACb,MAAc,EACd,SAAiB;IAEjB,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAgB,EAChB,KAAa,EACb,MAAc,EACd,SAAiB;IAEjB,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,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B,EACnB,mBAA6B,EAC7B,IAAqB,EACrB,WAAkE;IAElE,MAAM,eAAe,GAAa,EAAE,CAAC;IACrC,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;QACjD,eAAe,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACnC,MAAM,IAAI,UAAU,CAAC;IACvB,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const VERSION: string;
|
package/dist/constants.js
DELETED
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/dist/esm/package.json
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pixzle/node",
|
|
3
|
-
"version": "0.0.14",
|
|
4
|
-
"description": "Node.js implementation of image fragmentation and restoration",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/cjs/index.js",
|
|
7
|
-
"module": "dist/esm/index.js",
|
|
8
|
-
"types": "dist/esm/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": {
|
|
12
|
-
"types": "./dist/esm/index.d.ts",
|
|
13
|
-
"default": "./dist/esm/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/cjs/index.d.ts",
|
|
17
|
-
"default": "./dist/cjs/index.js"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "pnpm run build:esm && pnpm run build:cjs",
|
|
26
|
-
"build:esm": "tsc -p tsconfig.build.json --outDir dist/esm --module ES2022 --moduleResolution bundler && cp package.json dist/esm/",
|
|
27
|
-
"build:cjs": "tsc -p tsconfig.build.json --outDir dist/cjs --module CommonJS --moduleResolution node && cp package.json dist/cjs/ && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
28
|
-
"build:check": "tsc -p tsconfig.build.json --noEmit",
|
|
29
|
-
"test": "vitest"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [],
|
|
32
|
-
"author": "tuki0918",
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "https://github.com/tuki0918/pixzle.git",
|
|
36
|
-
"directory": "packages/node"
|
|
37
|
-
},
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@pixzle/core": "workspace:*",
|
|
44
|
-
"@tuki0918/seeded-shuffle": "^1.0.0",
|
|
45
|
-
"jimp": "^1.6.0"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/node": "^22.10.2",
|
|
49
|
-
"@types/pngjs": "^6.0.5",
|
|
50
|
-
"typescript": "^5.7.2",
|
|
51
|
-
"vitest": "^3.1.4"
|
|
52
|
-
}
|
|
53
|
-
}
|
package/dist/file.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a directory
|
|
3
|
-
* @param dir Directory path
|
|
4
|
-
* @param recursive Create parent directories if they don't exist
|
|
5
|
-
*/
|
|
6
|
-
export declare function createDir(dir: string, recursive?: boolean): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Write a file
|
|
9
|
-
* @param dir Directory path
|
|
10
|
-
* @param filename Filename
|
|
11
|
-
* @param data Data to write
|
|
12
|
-
* @returns Path to the file
|
|
13
|
-
*/
|
|
14
|
-
export declare function writeFile(dir: string, filename: string, data: string | Buffer): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Read a JSON file and return its content
|
|
17
|
-
* @param filePath Path to the JSON file
|
|
18
|
-
* @returns Content of the JSON file
|
|
19
|
-
*/
|
|
20
|
-
export declare function readJsonFile<T>(filePath: string): Promise<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Read a file and return its content
|
|
23
|
-
* @param filePath Path to the file
|
|
24
|
-
* @returns Content of the file
|
|
25
|
-
*/
|
|
26
|
-
export declare function readFileBuffer(filePath: string): Promise<Buffer>;
|
|
27
|
-
/**
|
|
28
|
-
* Get the filename without the extension
|
|
29
|
-
* @param filePath Path to the file
|
|
30
|
-
* @returns Filename without the extension
|
|
31
|
-
*/
|
|
32
|
-
export declare function fileNameWithoutExtension(filePath: string): string;
|
package/dist/file.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
/**
|
|
4
|
-
* Create a directory
|
|
5
|
-
* @param dir Directory path
|
|
6
|
-
* @param recursive Create parent directories if they don't exist
|
|
7
|
-
*/
|
|
8
|
-
export async function createDir(dir, recursive = false) {
|
|
9
|
-
await fs.mkdir(dir, { recursive });
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Write a file
|
|
13
|
-
* @param dir Directory path
|
|
14
|
-
* @param filename Filename
|
|
15
|
-
* @param data Data to write
|
|
16
|
-
* @returns Path to the file
|
|
17
|
-
*/
|
|
18
|
-
export async function writeFile(dir, filename, data) {
|
|
19
|
-
const filePath = path.join(dir, filename);
|
|
20
|
-
await fs.writeFile(filePath, data);
|
|
21
|
-
return filePath;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Read a JSON file and return its content
|
|
25
|
-
* @param filePath Path to the JSON file
|
|
26
|
-
* @returns Content of the JSON file
|
|
27
|
-
*/
|
|
28
|
-
export async function readJsonFile(filePath) {
|
|
29
|
-
return JSON.parse(await fs.readFile(filePath, "utf8"));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Read a file and return its content
|
|
33
|
-
* @param filePath Path to the file
|
|
34
|
-
* @returns Content of the file
|
|
35
|
-
*/
|
|
36
|
-
export async function readFileBuffer(filePath) {
|
|
37
|
-
return await fs.readFile(filePath);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get the filename without the extension
|
|
41
|
-
* @param filePath Path to the file
|
|
42
|
-
* @returns Filename without the extension
|
|
43
|
-
*/
|
|
44
|
-
export function fileNameWithoutExtension(filePath) {
|
|
45
|
-
return path.basename(filePath, path.extname(filePath));
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=file.js.map
|
package/dist/file.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,SAAS,GAAG,KAAK;IAC5D,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,QAAgB,EAChB,IAAqB;IAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,QAAgB;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAgB;IACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/fragmenter.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type FragmentationConfig, type FragmentationResult } from "@pixzle/core";
|
|
2
|
-
export declare class ImageFragmenter {
|
|
3
|
-
private config;
|
|
4
|
-
constructor(config: FragmentationConfig);
|
|
5
|
-
private _initializeConfig;
|
|
6
|
-
fragmentImages(paths: string[]): Promise<FragmentationResult>;
|
|
7
|
-
private _createImages;
|
|
8
|
-
private _createManifest;
|
|
9
|
-
private _prepareData;
|
|
10
|
-
private _processImages;
|
|
11
|
-
private _processImage;
|
|
12
|
-
private _createImage;
|
|
13
|
-
}
|
package/dist/fragmenter.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_FRAGMENTATION_CONFIG, calculateBlockCountsForCrossImages, calculateBlockCountsPerImage, calculateBlockRange, encodeFileName, validateFileNames, } from "@pixzle/core";
|
|
2
|
-
import { SeededRandom, shuffle } from "@tuki0918/seeded-shuffle";
|
|
3
|
-
import { blocksPerImage, blocksToPngImage, imageFileToBlocks } from "./block";
|
|
4
|
-
import { VERSION } from "./constants";
|
|
5
|
-
import { fileNameWithoutExtension, readFileBuffer } from "./file";
|
|
6
|
-
import { generateManifestId } from "./utils";
|
|
7
|
-
export class ImageFragmenter {
|
|
8
|
-
config;
|
|
9
|
-
constructor(config) {
|
|
10
|
-
this.config = this._initializeConfig(config);
|
|
11
|
-
}
|
|
12
|
-
_initializeConfig(config) {
|
|
13
|
-
return {
|
|
14
|
-
blockSize: config.blockSize ?? DEFAULT_FRAGMENTATION_CONFIG.BLOCK_SIZE,
|
|
15
|
-
prefix: config.prefix ?? DEFAULT_FRAGMENTATION_CONFIG.PREFIX,
|
|
16
|
-
seed: config.seed || SeededRandom.generateSeed(),
|
|
17
|
-
preserveName: config.preserveName ?? DEFAULT_FRAGMENTATION_CONFIG.PRESERVE_NAME,
|
|
18
|
-
crossImageShuffle: config.crossImageShuffle ??
|
|
19
|
-
DEFAULT_FRAGMENTATION_CONFIG.CROSS_IMAGE_SHUFFLE,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
async fragmentImages(paths) {
|
|
23
|
-
const { manifest, blocks, blockCountsForCrossImages, blockCountsPerImage } = await this._prepareData(paths);
|
|
24
|
-
const shuffled = this.config.crossImageShuffle
|
|
25
|
-
? shuffle(blocks, manifest.config.seed)
|
|
26
|
-
: blocksPerImage(blocks, blockCountsPerImage, manifest.config.seed, shuffle);
|
|
27
|
-
const blockCounts = this.config.crossImageShuffle
|
|
28
|
-
? blockCountsForCrossImages
|
|
29
|
-
: blockCountsPerImage;
|
|
30
|
-
const fragmentedImages = await this._createImages(shuffled, blockCounts, manifest);
|
|
31
|
-
return {
|
|
32
|
-
manifest,
|
|
33
|
-
fragmentedImages,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async _createImages(blocks, blockCounts, manifest) {
|
|
37
|
-
return await Promise.all(manifest.images.map(async (_, index) => {
|
|
38
|
-
const { start, end } = calculateBlockRange(blockCounts, index);
|
|
39
|
-
const imageBlocks = blocks.slice(start, end);
|
|
40
|
-
return await this._createImage(imageBlocks, manifest.config.blockSize);
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
_createManifest(manifestId, imageInfos) {
|
|
44
|
-
return {
|
|
45
|
-
id: manifestId,
|
|
46
|
-
version: VERSION,
|
|
47
|
-
timestamp: new Date().toISOString(),
|
|
48
|
-
config: this.config,
|
|
49
|
-
images: imageInfos,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
async _prepareData(paths) {
|
|
53
|
-
const manifestId = generateManifestId();
|
|
54
|
-
const { imageInfos, blocks } = await this._processImages(paths);
|
|
55
|
-
validateFileNames(imageInfos, this.config.preserveName);
|
|
56
|
-
const manifest = this._createManifest(manifestId, imageInfos);
|
|
57
|
-
const blockCountsForCrossImages = calculateBlockCountsForCrossImages(blocks.length, paths.length);
|
|
58
|
-
// Calculate actual block counts per image for per-image shuffle
|
|
59
|
-
const blockCountsPerImage = calculateBlockCountsPerImage(imageInfos);
|
|
60
|
-
return { manifest, blocks, blockCountsForCrossImages, blockCountsPerImage };
|
|
61
|
-
}
|
|
62
|
-
async _processImages(paths) {
|
|
63
|
-
const results = await Promise.all(paths.map((path) => this._processImage(path)));
|
|
64
|
-
const imageInfos = results.map((r) => r.imageInfo);
|
|
65
|
-
const blocks = results.flatMap((r) => r.blocks);
|
|
66
|
-
return { imageInfos, blocks };
|
|
67
|
-
}
|
|
68
|
-
async _processImage(path) {
|
|
69
|
-
const buffer = await readFileBuffer(path);
|
|
70
|
-
const { blocks, width, height, blockCountX, blockCountY } = await imageFileToBlocks(buffer, this.config.blockSize);
|
|
71
|
-
const imageInfo = {
|
|
72
|
-
w: width,
|
|
73
|
-
h: height,
|
|
74
|
-
c: 4, // Always use 4 channels (RGBA) for generated PNG
|
|
75
|
-
x: blockCountX,
|
|
76
|
-
y: blockCountY,
|
|
77
|
-
name: this.config.preserveName
|
|
78
|
-
? encodeFileName(fileNameWithoutExtension(path))
|
|
79
|
-
: undefined,
|
|
80
|
-
};
|
|
81
|
-
return { imageInfo, blocks };
|
|
82
|
-
}
|
|
83
|
-
async _createImage(blocks, blockSize) {
|
|
84
|
-
const blockCount = blocks.length;
|
|
85
|
-
const blocksPerRow = Math.ceil(Math.sqrt(blockCount));
|
|
86
|
-
const imageWidth = blocksPerRow * blockSize;
|
|
87
|
-
const imageHeight = Math.ceil(blockCount / blocksPerRow) * blockSize;
|
|
88
|
-
return await blocksToPngImage(blocks, imageWidth, imageHeight, blockSize);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=fragmenter.js.map
|
package/dist/fragmenter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fragmenter.js","sourceRoot":"","sources":["../src/fragmenter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAK5B,kCAAkC,EAClC,4BAA4B,EAC5B,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,eAAe;IAClB,MAAM,CAAgC;IAE9C,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAEO,iBAAiB,CACvB,MAA2B;QAE3B,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,4BAA4B,CAAC,UAAU;YACtE,MAAM,EA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AY,CAAC,GAAG,SAAS,CAAC;QAErE,OAAO,MAAM,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type FragmentationConfig, type ManifestData, type RestoreOptions, type ShuffleOptions } from "@pixzle/core";
|
|
2
|
-
import { ImageFragmenter } from "./fragmenter";
|
|
3
|
-
import { ImageRestorer } from "./restorer";
|
|
4
|
-
export { ImageFragmenter, ImageRestorer, type FragmentationConfig, type ManifestData, };
|
|
5
|
-
declare function shuffle(options: ShuffleOptions): Promise<void>;
|
|
6
|
-
declare function restore(options: RestoreOptions): Promise<void>;
|
|
7
|
-
declare const pixzle: {
|
|
8
|
-
shuffle: typeof shuffle;
|
|
9
|
-
restore: typeof restore;
|
|
10
|
-
};
|
|
11
|
-
export default pixzle;
|
package/dist/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { MANIFEST_FILE_NAME, generateFragmentFileName, generateRestoredFileName, generateRestoredOriginalFileName, validateFragmentImageCount, } from "@pixzle/core";
|
|
2
|
-
import { createDir, readJsonFile, writeFile } from "./file";
|
|
3
|
-
import { ImageFragmenter } from "./fragmenter";
|
|
4
|
-
import { ImageRestorer } from "./restorer";
|
|
5
|
-
export { ImageFragmenter, ImageRestorer, };
|
|
6
|
-
async function shuffle(options) {
|
|
7
|
-
const { imagePaths, config, outputDir } = validateShuffleOptions(options);
|
|
8
|
-
const fragmenter = new ImageFragmenter(config ?? {});
|
|
9
|
-
const { manifest, fragmentedImages } = await fragmenter.fragmentImages(imagePaths);
|
|
10
|
-
await createDir(outputDir, true);
|
|
11
|
-
await writeFile(outputDir, MANIFEST_FILE_NAME, JSON.stringify(manifest, null, 2));
|
|
12
|
-
await Promise.all(fragmentedImages.map((img, i) => {
|
|
13
|
-
const filename = generateFragmentFileName(manifest, i);
|
|
14
|
-
return writeFile(outputDir, filename, img);
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
async function restore(options) {
|
|
18
|
-
const { imagePaths, manifestPath, outputDir } = validateRestoreOptions(options);
|
|
19
|
-
const manifest = await readJsonFile(manifestPath);
|
|
20
|
-
validateFragmentImageCount(imagePaths, manifest);
|
|
21
|
-
const restorer = new ImageRestorer();
|
|
22
|
-
const restoredImages = await restorer.restoreImages(imagePaths, manifest);
|
|
23
|
-
await createDir(outputDir, true);
|
|
24
|
-
const imageInfos = manifest.images;
|
|
25
|
-
await Promise.all(restoredImages.map((img, i) => {
|
|
26
|
-
const filename = generateRestoredOriginalFileName(imageInfos[i]) ??
|
|
27
|
-
generateRestoredFileName(manifest, i);
|
|
28
|
-
return writeFile(outputDir, filename, img);
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
const pixzle = {
|
|
32
|
-
shuffle,
|
|
33
|
-
restore,
|
|
34
|
-
};
|
|
35
|
-
export default pixzle;
|
|
36
|
-
function validateCommonOptions(options, context) {
|
|
37
|
-
if (!options)
|
|
38
|
-
throw new Error(`[${context}] Options object is required.`);
|
|
39
|
-
const { imagePaths, outputDir } = options;
|
|
40
|
-
if (!imagePaths || !Array.isArray(imagePaths) || imagePaths.length === 0)
|
|
41
|
-
throw new Error(`[${context}] imagePaths must be a non-empty array.`);
|
|
42
|
-
if (!outputDir || typeof outputDir !== "string")
|
|
43
|
-
throw new Error(`[${context}] outputDir is required and must be a string.`);
|
|
44
|
-
return options;
|
|
45
|
-
}
|
|
46
|
-
function validateShuffleOptions(options) {
|
|
47
|
-
return validateCommonOptions(options, "shuffle");
|
|
48
|
-
}
|
|
49
|
-
function validateRestoreOptions(options) {
|
|
50
|
-
const { manifestPath } = options;
|
|
51
|
-
if (!manifestPath || typeof manifestPath !== "string")
|
|
52
|
-
throw new Error("[restore] manifestPath is required and must be a string.");
|
|
53
|
-
return validateCommonOptions(options, "restore");
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=index.js.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C;IACxE,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;QAC7C,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,+CAA+C,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAuB;IACrD,OAAO,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAuB;IACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjC,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ;QACnD,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,OAAO,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/package.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pixzle/node",
|
|
3
|
-
"version": "0.0.14",
|
|
4
|
-
"description": "Node.js implementation of image fragmentation and restoration",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/cjs/index.js",
|
|
7
|
-
"module": "dist/esm/index.js",
|
|
8
|
-
"types": "dist/esm/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": {
|
|
12
|
-
"types": "./dist/esm/index.d.ts",
|
|
13
|
-
"default": "./dist/esm/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/cjs/index.d.ts",
|
|
17
|
-
"default": "./dist/cjs/index.js"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "pnpm run build:copy && pnpm run build:esm && pnpm run build:cjs",
|
|
26
|
-
"build:copy": "cp package.json dist/",
|
|
27
|
-
"build:esm": "tsc -p tsconfig.build.json --outDir dist/esm --module ESNext --moduleResolution bundler",
|
|
28
|
-
"build:cjs": "tsc -p tsconfig.build.json --outDir dist/cjs --module CommonJS --moduleResolution node && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
29
|
-
"build:check": "tsc -p tsconfig.build.json --noEmit",
|
|
30
|
-
"test": "vitest"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [],
|
|
33
|
-
"author": "tuki0918",
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "https://github.com/tuki0918/pixzle.git",
|
|
37
|
-
"directory": "packages/node"
|
|
38
|
-
},
|
|
39
|
-
"license": "MIT",
|
|
40
|
-
"publishConfig": {
|
|
41
|
-
"access": "public"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@pixzle/core": "workspace:*",
|
|
45
|
-
"@tuki0918/seeded-shuffle": "^1.0.0",
|
|
46
|
-
"jimp": "^1.6.0"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@types/node": "^22.10.2",
|
|
50
|
-
"@types/pngjs": "^6.0.5",
|
|
51
|
-
"typescript": "^5.7.2",
|
|
52
|
-
"vitest": "^3.1.4"
|
|
53
|
-
}
|
|
54
|
-
}
|
package/dist/restorer.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ManifestData } from "@pixzle/core";
|
|
2
|
-
export declare class ImageRestorer {
|
|
3
|
-
restoreImages(fragments: (string | Buffer)[], manifest: ManifestData): Promise<Buffer[]>;
|
|
4
|
-
private _reconstructImages;
|
|
5
|
-
private _prepareData;
|
|
6
|
-
private _readBlocksFromFragment;
|
|
7
|
-
private _readBlocks;
|
|
8
|
-
private _createImage;
|
|
9
|
-
}
|
package/dist/restorer.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { calculateBlockCountsForCrossImages, calculateBlockCountsPerImage, calculateBlockRange, calculateTotalBlocks, } from "@pixzle/core";
|
|
2
|
-
import { unshuffle } from "@tuki0918/seeded-shuffle";
|
|
3
|
-
import { blocksPerImage, blocksToPngImage, imageFileToBlocks } from "./block";
|
|
4
|
-
import { readFileBuffer } from "./file";
|
|
5
|
-
export class ImageRestorer {
|
|
6
|
-
async restoreImages(fragments, manifest) {
|
|
7
|
-
const { blocks, blockCountsPerImage } = await this._prepareData(fragments, manifest);
|
|
8
|
-
const restored = manifest.config.crossImageShuffle
|
|
9
|
-
? unshuffle(blocks, manifest.config.seed)
|
|
10
|
-
: blocksPerImage(blocks, blockCountsPerImage, manifest.config.seed, unshuffle);
|
|
11
|
-
return await this._reconstructImages(restored, manifest);
|
|
12
|
-
}
|
|
13
|
-
async _reconstructImages(blocks, manifest) {
|
|
14
|
-
const blockCountsPerImage = calculateBlockCountsPerImage(manifest.images);
|
|
15
|
-
return await Promise.all(manifest.images.map(async (imageInfo, index) => {
|
|
16
|
-
const { start, end } = calculateBlockRange(blockCountsPerImage, index);
|
|
17
|
-
const imageBlocks = blocks.slice(start, end);
|
|
18
|
-
return await this._createImage(imageBlocks, manifest.config.blockSize, imageInfo);
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
async _prepareData(fragments, manifest) {
|
|
22
|
-
const totalBlocks = calculateTotalBlocks(manifest.images);
|
|
23
|
-
const blockCountsForCrossImages = calculateBlockCountsForCrossImages(totalBlocks, fragments.length);
|
|
24
|
-
// Calculate actual block counts per image for per-image unshuffle
|
|
25
|
-
const blockCountsPerImage = calculateBlockCountsPerImage(manifest.images);
|
|
26
|
-
// Use blockCountsPerImage when crossImageShuffle is false
|
|
27
|
-
const blockCounts = manifest.config.crossImageShuffle
|
|
28
|
-
? blockCountsForCrossImages
|
|
29
|
-
: blockCountsPerImage;
|
|
30
|
-
const blocks = await this._readBlocks(fragments, manifest, blockCounts);
|
|
31
|
-
return { blocks, blockCountsPerImage };
|
|
32
|
-
}
|
|
33
|
-
// Extract an array of blocks (Buffer) from a fragment image
|
|
34
|
-
async _readBlocksFromFragment(fragment, manifest, expectedCount) {
|
|
35
|
-
const buffer = Buffer.isBuffer(fragment)
|
|
36
|
-
? fragment
|
|
37
|
-
: await readFileBuffer(fragment);
|
|
38
|
-
const { blocks } = await imageFileToBlocks(buffer, manifest.config.blockSize);
|
|
39
|
-
return blocks.slice(0, expectedCount);
|
|
40
|
-
}
|
|
41
|
-
async _readBlocks(fragments, manifest, blockCounts) {
|
|
42
|
-
const blockGroups = await Promise.all(fragments.map((fragment, i) => this._readBlocksFromFragment(fragment, manifest, blockCounts[i])));
|
|
43
|
-
return blockGroups.flat();
|
|
44
|
-
}
|
|
45
|
-
async _createImage(blocks, blockSize, imageInfo) {
|
|
46
|
-
const { w, h } = imageInfo;
|
|
47
|
-
return await blocksToPngImage(blocks, w, h, blockSize);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=restorer.js.map
|
package/dist/restorer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restorer.js","sourceRoot":"","sources":["../src/restorer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kCAAkC,EAClC,4BAA4B,EAC5B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,aAAa,CACjB,SAA8B,EAC9B,QAAsB;QAEtB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,CAC7D,SAAS,EACT,QAAQ,CACT,CAAC;QAEF,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,iBAAiB;YAChD,CAAC,CAAC,SAAS,CAAC,M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-1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC"}
|