mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 01:37:26 +00:00
Oooops. Old files
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
import {dirname} from "path";
|
|
||||||
globalThis.__dirname = dirname(import.meta.url);
|
|
||||||
import { createRequire } from 'module';
|
|
||||||
|
|
||||||
globalThis.require = createRequire(import.meta.url);
|
|
||||||
import visdif from './visdif.js';
|
|
||||||
|
|
||||||
const {VisDiff} = await visdif({
|
|
||||||
locateFile() {
|
|
||||||
return new URL("./visdif.wasm", import.meta.url).pathname;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const comparator = new VisDiff(
|
|
||||||
new Uint8ClampedArray([0, 0, 0, 255]),
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
const distance = comparator.distance(new Uint8ClampedArray([1,1,1,255]));
|
|
||||||
console.log({distance});
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import {dirname} from "path";
|
|
||||||
globalThis.__dirname = dirname(import.meta.url);
|
|
||||||
import { createRequire } from 'module';
|
|
||||||
|
|
||||||
globalThis.require = createRequire(import.meta.url);
|
|
||||||
import visdif from './visdif.js';
|
|
||||||
|
|
||||||
const {VisDiff} = await visdif({
|
|
||||||
locateFile() {
|
|
||||||
return new URL("./visdif.wasm", import.meta.url).pathname;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const comparator = new VisDiff(
|
|
||||||
new Uint8ClampedArray([0, 0, 0, 255]),
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
const distance = comparator.distance(new Uint8ClampedArray([1,1,1,255]));
|
|
||||||
console.log({distance});
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { ImagePool } from './build/index.js';
|
|
||||||
|
|
||||||
console.log("Starting");
|
|
||||||
const imagePool = new ImagePool();
|
|
||||||
// const imagePath = '/Users/surma/Downloads/happy_dog.png';
|
|
||||||
const imagePath = './squoosh.png';
|
|
||||||
console.log("INgesting");
|
|
||||||
const image = imagePool.ingestImage(imagePath);
|
|
||||||
console.log("Decoding");
|
|
||||||
await image.decoded;
|
|
||||||
const encodeOptions = {
|
|
||||||
mozjpeg: 'auto',
|
|
||||||
};
|
|
||||||
console.log("Encoding");
|
|
||||||
await image.encode(encodeOptions);
|
|
||||||
console.log("Closing");
|
|
||||||
await imagePool.close();
|
|
||||||
console.log("Done");
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
Reference in New Issue
Block a user