Launching AI Generative Art NFT Collection with Craiyon (ex DALL-E Mini)

Leonid MeleshinLeonid Meleshin
2 min read

TL;DR;

Overthinking can be useful, but not always. Use existing tools and find new ways to simplify things

The Idea

I've been scrolling through twitter, when I faced a bunch of funny threads, featuring images, generated by DALL-E Mini. It was then, when I decided, I want to launch my NFT collection.

So I quickly hopped into it and did a few checks

DALL-E Mini results

Generating images

I wrote a simple script, that downloads 10000 images from DALL-E Mini and saves them:

import fs from 'fs/promises'
import path from 'path'
import fetch from 'node-fetch'

const URL = 'https://bf.dallemini.ai/generate'
const QUERY = 'nft'

interface Response {
    images: string[]
    version: string
}

const loadBatch = async (): Promise<string[]> => {
    const response = await fetch(URL, {
        method: 'POST',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ prompt: QUERY }),
    })

    const data = await response.json() as Response;

    return data.images
}

const saveBatch = async (images: Record<number, string>) => {
    Object.entries(images).forEach(async ([number, content]) => {
        await fs.writeFile(path.join(__dirname, `../images/${number}.png`), content, { encoding: 'base64' })
    });
}

const createCollection = async (size: number) => {
    let current = 0

    while (current < size) {
        const images = await loadBatch();
        await saveBatch(Object.fromEntries(images.map((image, index) => [current + index, image])))
        current += images.length
    }
}

createCollection(10000)

Upscaling images

Initially generated images were only 256x256px size, and were very noisy, so I've decided to upload them to AI image upscale service and like this, I've got 10000 new and very sharp images in 1024x1024 resolution!

Upscale comparison

Uploading images to IPFS

In crypto space all NFT assets are stored in IPFS, so I've decided to use NFTUp by NFT.Storage. It allows to easily upload entire folders in batch into IPFS

NFTUp

Creating NFT Contract

By that time I already knew about @skogard's awesome Factoria contracts. It allows to launch upgradeable ERC-721 collection with little to no gas (just ~$20!)

So after giving my collection a name and attaching my uploaded images to IPFS previously, I got my NFT collection ready: here it is on Etherscan!

Mint Collection

You there are several options to mint this collection:

It is completely free mint! Give it a try!

0
Subscribe to my newsletter

Read articles from Leonid Meleshin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Leonid Meleshin
Leonid Meleshin