nftgen 0.0.5
nftgen: ^0.0.5 copied to clipboard
NFT unique image generator and metadata analyzer, available as package and CLI.
nftgen #
NFT unique image generator and metadata analyzer. Package and CLI enabled.
Generating NFTs follows this procedure:
- Generate project-file based on layers directory
- Manually: Adjust probabilities in project-file
- Generate NFT metadata files
- Analyse rarity distribution, backtrace to 2.
- Generate NFT images
- Manually: Upload NFT images and get a CID
- Update all metadata files with CID
- Manually: Upload metadata files
Which translates to these commands:
nftgen init ...
- ( ... )
nftgen meta ...
nftgen rarity ...
nftgen nft ...
- ( ... )
nftgen cid ...
- ( ... )
Quickstart #
dart pub global activate nftgen
nftgen init init -p ./project/ -l ./project/layers/ -n "Your NFT" -o
nftgen meta -p ./project/
nftgen rarity -p ./project/
nftgen nft -p ./project/
nftgen cid -p ./project/ -c yourCID
nftgen init
creates project.json
in a project directory of your choice. The command requires a layers directory. The project directory may be the parent directory of the layers directory.
Regarding all commands: The OPTIONAL parameter -p ./project/
specifies the project directory. If not given, the current directory will be used.
project.json #
Open project.json
, re-order the layers, and adjust their weights to your liking:
// project.json
{
// IGNORE INTERNAL SECTION BELOW
"layerDir": "<Path to your layers>",
"metaDir": "meta",
"imageDir": "image",
"rarityDir": "rarity",
"rarityNftCsv": "rarity_nft.csv",
"rarityNftPng": "rarity_nft.png",
"rarityLayersCsv": "rarity_layers.csv",
"rarityLayersPng": "rarity_layers.png",
// IGNORE INTERNAL SECTION ABOVE
"name": "Your NFT",
// How many NFTs to generate.
// Defaults to 0.6 * all-combinations-equal-weights
// to avoid rendering slowing down when reaching
// all-combinations-equal-weights number.
"generateNfts": 250,
// Run "nftgen cid -c yourNewCID" to update the metadata files.
// Do NOT change manually:
"cidCode": "<-- Your CID code -->",
// The order of layer entries matters.
"layers": [
{
// Shown in generated metadata JSON.
"name": "Eyeball",
// Your local layer directory.
"directory": "Eyeball",
// Probability of layer to be used: 0.0...1.0
// Which eqals: 0...100%
"probability": 1.0,
// Probability of files to be used.
// Here, sum of all weights is 17.
"weights": {
// Probability: 1 / 17
"Red.png": 1,
// Probability: 16 / 17
"White.png": 16
}
},
// ( ... more layers ...)
}
Probability and Weights
-
Change the steepness of a layer's
weights
sequence with the-w
parameter:nftgen init -p ./project/ -w 3.0
. The larger the NFT collection, the steeper the weights within each layer have to be. Set-w
to3.0, 4.0, 5.0, ...
. -
Set the
probability
of rare layers inproject.json
manually to0.05, 0.1, 0.25
etc.
How to Use #
Library #
try {
final sep = Platform.pathSeparator;
final String projectDir = 'project';
final String layerDir = '$projectDir${sep}layer';
final String name = "NFT Test name";
await cli.init(projectDir, layerDir, name, true);
await cli.meta(projectDir);
await cli.rarity(projectDir);
await cli.cid(projectDir, "NEW-CID");
await cli.nft(projectDir);
} on NftCliException catch (e) {
print(e.message);
}
Command Line #
Activate and deactive the shell command:
dart pub global activate nftgen
dart pub global deactivate nftgen
Commands accept an OPTIONAL parameter specifying the project-directory. Otherwise, the current directory will be used.
Try nftgen.dart help
and nftgen.dart help <COMMAND>
for further information.
> dart pub global activate nftgen
> nftgen.dart help
Generate NFTs
Usage: nftgen <command> [arguments]
Global options:
-h, --help Print this usage information.
Available commands:
cid Updates CID of generated metadata
init Initiates a new project
meta Generates NFT metadata
nft Generates NFT images based on metadata
rarity Generates rarity CSV reports
Run "nftgen help <command>" for more information about a command.
References #
The example layers are from Hashlips (MIT livense)
https://github.com/HashLips/hashlips_art_engine
License #
MIT