exported the generateRandomImage function :)

This commit is contained in:
2024-03-22 13:32:01 +01:00
parent 90c5f9ec8e
commit 8bb360b751
4 changed files with 9 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
# generative-art # layered-generative-art
An easy-to-use library to generate random images from a set of layers. An easy-to-use library to generate random images from a set of layers.
## Installation ## Installation

View File

@@ -3,6 +3,7 @@ import dts from "bun-plugin-dts";
await Bun.build({ await Bun.build({
entrypoints: ["./src/index.ts"], entrypoints: ["./src/index.ts"],
outdir: "./dist", outdir: "./dist",
target: "node",
minify: true, minify: true,
plugins: [dts()], plugins: [dts()],
}); });

View File

@@ -9,7 +9,8 @@
"module": "index.ts", "module": "index.ts",
"license": "MIT", "license": "MIT",
"files": [ "files": [
"dist" "dist/*.js",
"dist/*.d.ts"
], ],
"keywords": [ "keywords": [
"generative", "generative",
@@ -25,6 +26,10 @@
"url": "git+https://github.com/4-0-9/layered-generative-art.git" "url": "git+https://github.com/4-0-9/layered-generative-art.git"
}, },
"bugs": "https://github.com/4-0-9/layered-generative-art/issues", "bugs": "https://github.com/4-0-9/layered-generative-art/issues",
"scripts": {
"build": "bun run build.mjs",
"publish": "bun run build && npm publish"
},
"dependencies": { "dependencies": {
"sharp": "^0.33.2" "sharp": "^0.33.2"
}, },

View File

@@ -6,7 +6,7 @@ import { type Layer, type TraitOption } from './layers';
* @param orderedLayers - The layers to choose from in ascending order * @param orderedLayers - The layers to choose from in ascending order
* @returns A buffer containing the newly generated image * @returns A buffer containing the newly generated image
*/ */
async function generateRandomImage(baseShapePath: string, orderedLayers: Layer[]): Promise<GenerativeArtOutput> { export async function generateRandomImage(baseShapePath: string, orderedLayers: Layer[]): Promise<GenerativeArtOutput> {
const layers: OverlayOptions[] = []; const layers: OverlayOptions[] = [];
const choices: Record<string, string> = {}; const choices: Record<string, string> = {};