It is recommended to start by running the generator using the sample art to be sure everything is installed correctly without any node errors.
Node.js v14 or higher (16 is recommended)
NPM or Yarn
// yarn
yarn
// npm
npm install
💡Note for M1 Macs. You may run into node-gpy or node-canvas errors during installation. If you do, first delete the yarn.lock and/or package.lock files, then try installing agin. For Canvas issues when running the generator, run yarn add canvas
or npm install --save-dev canvas
to install the m1 version.
The generator by default will build from the layers
directory. To build the sample art, run
// yarn
yarn generate
// npm
npm run generate
If you see a new build/
directory with images, json, and _dna.json 🎉 congrats! everything is working!!
To use your own artwork, replace everything with your own folders inside the layers
folder. Then, configure the order of your layers and the number you would like to create in ./src/config.js
Each {}
Object should be the name of your layer folder, matched exactly
const layerConfigurations = [
{
growEditionSizeTo: 10,
namePrefix: "Series 2", // Use to add a name to Metadata `name:`
layersOrder: [
{ name: "Background" },
{ name: "Head" },
{ name: "Body" },
{ name: "Clothes" },
{ name: "Eye" },
],
},
const outputJPEG
By default, the generator outputs PNG images. setting to true
will generate JPEG's.
const startIndex = 0;
By default, the generator will generate images starting at 0. Use this option to change the number the generator starts from.
const format = {
width: 512,
height: 512,
smoothing: true, // set to false when up-scaling pixel art.
};
Set the width and height of the generated image. Be sure that this matches the aspect ratio of the input layers from the layers/
folder. For the highest quality results, the output should match the input file size to avoid scaling.
When the input art is small (pixel art for example) and you would like to scale it while retaining the sharpness, turn this off with, smoothing: false