Skip to content

Commit

Permalink
v1.0.0-beta
Browse files Browse the repository at this point in the history
+ Config support for baseURI
  • Loading branch information
Jon-Becker committed Nov 1, 2021
1 parent cec5acb commit 01245d2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ def create_new_image(all_images, config):
new_image = {}
for layer in config["layers"]:
new_image[layer["name"]] = random.choices(layer["values"], layer["weights"])[0]

if new_image in all_images:
return create_new_image(all_images, config)
return create_new_image(all_images, config)
else:
return new_image
return new_image

def generate_unique_images(amount, config):
pad_amount = len(str(amount));
Expand All @@ -38,7 +38,7 @@ def generate_unique_images(amount, config):
if key != "tokenId":
attributes.append({"trait_type": key, "value": token[key]})
token_metadata = {
"image": "./images/" + str(i).zfill(pad_amount) + '.png',
"image": config["baseURI"] + "/images/" + str(i).zfill(pad_amount) + '.png',
"tokenId": i,
"name": config["name"] + str(i).zfill(pad_amount),
"attributes": attributes
Expand Down Expand Up @@ -86,10 +86,10 @@ def generate_unique_images(amount, config):
},
{
"name": "Foreground",
"values": ["Python Logo"],
"values": ["Python Logo", "Python Logo 2"],
"trait_path": "./trait-layers/foreground",
"filename": ["logo"],
"weights": [100]
"filename": ["logo", "logo"],
"weights": [50, 50]
},
{
"name": "Branding",
Expand All @@ -99,6 +99,7 @@ def generate_unique_images(amount, config):
"weights": [100]
}
],
"baseURI": ".",
"name": "NFT #"
})

Expand Down

0 comments on commit 01245d2

Please sign in to comment.