GithubHelp home page GithubHelp logo

denver-code / nftgenerator Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 22 KB

This repository provides various utilities to help you build your NFT collection!

Go 100.00%
go nft generator nft-gallery golang cli

nftgenerator's Introduction

Attention! A powerful computer may be required!

About

This repository provides various utilities to help you build your NFT collection:

  • Generate images from source layers / Merge layers in the specified order
  • Generate ERC-721 traits
  • Upload images to IPFS
  • Upload metadata to IPFS

How to generate images

Run the following command: go main.go --generated-image-input=${IMG_DIR} --generated-image-output=${OUTPUT_DIR} --generated-image-length=2048 --generated-image-width=2048 --generated-image-number=100 --generate

Flags

  • generated-image-input - image input directory where the source layers are located (default is input-dir)
  • generated-image-output - image output directory where generated images will be saved here (default is output-dir)
  • generated-image-length - canvas length (default is 2048 px)
  • generated-image-width - canvas width (default is 2048 px)
  • generated-image-number - the number of images to be generated (default is 100 images)

Folders format

To merge layers in the correct order, the input layers directory must be in the following format:

  • input-dir:
    • 01_trait_group
      • trait_name.png
      • trait_name.png
      • trait_name.png
    • 02_trait_group
      • trait_name.png
    • 03_trait_group
      • trait_name.png

How to make some traits more rare than others?

Basically all traits are equal, but you can make one trait more rare than others by adding .silver or .gold postfix to your layer.

  • .silver - makes a trait 2 times less frequent than others
  • .gold - makes a trait 4 times less frequent than others

Example: Let's make some traits more rare than others. Then the directory of input images should have the following structure:

  • input-dir:
    • 01_background
      • ice_cave.gold.png <-- this background will be 4 times less frequent than others
      • pink_city.png
      • heaven.png
    • 02_body
      • aliens.png
      • crab.png
    • 03_head
      • einstein.png
      • aviator.silver.png <-- this background will be 2 times less frequent than others
    • 04_pants
      • green_pants.png
      • safari_pants.png
    • 05_shoes
      • black_sneakers.png
      • yellow_sneakers.png
    • 06_accessories
      • super rare headphones.gold.png <-- this 06_accessorie will be 4 times less frequent than others
      • red headphones.png
      • orange headphones.png
    • 07_etc ...

How to upload images to IPFS/Pinata?

Run the following command: go main.go --ipfs-input=${INPUT_DIRECTORY} --ipfs-output=${IPFS_OUTPUT_DIRECTORY} --ipfs-api-key=${PINATA_KEY} --ipfs-secret-key=${PINATA_SECRET} --ipfs-upload

Flags

  • ipfs-input - input directory / images to upload
  • ipfs-output - output directory / ipfs hash & meatadata will be saved here
  • ipfs-api-key - Pinata API key
  • ipfs-secret-key - Pinata API secret key

Print statistics

Run the following command to print statistics: go main.go --generated-image-output=${IMG_DIR} --ipfs-output=${IPFS_OUTPUT_DIRECTORY} --info

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.