🔬 Image analysis flyout scaffold

This commit is contained in:
2022-02-08 14:48:04 -08:00
parent 8bb74404fc
commit 171d64c14a
9 changed files with 5594 additions and 35 deletions

View File

@@ -3,6 +3,7 @@ import { ISharpResizedImageStats } from "threetwo-ui-typings";
const imghash = require("imghash");
const leven = require("leven");
import { isNull, reject } from "lodash";
import fs from "fs";
export const extractMetadataFromImage = async (
imageFilePath: string
@@ -34,11 +35,17 @@ export const resizeImage = async (
return err;
}
console.log("Image file %s resized with the following parameters: %o", imageFile, info);
console.log("Image file resized with the following parameters: %o", info);
return info;
});
};
export const analyze = async (inputFilePath: string | Buffer) => {
const stats = await sharp(inputFilePath).stats();
// const { r, g, b } = dominant;
return stats;
}
export const calculateLevenshteinDistance = async (
imagePath1: string,
imagePath2: string