it looks like loadLayerImg
function maybe fails to load a specific image file
Thatās whatās confusing to me. All the images are separated in their respective files inside the input folder which is what the instructions say. For example ./input/Background, ./input/Base_head, ,/input/Headgear, etc. And in every folder theyāre further separated by rarity folders i.e. ācommon, uncommon, rareā¦ā etc. Every image is a 4320x4320px .png file. Could it be an image resolution issue? Are the images somehow too big? How do I fix it?
you added new images there in those folders from the original tutorial?
WOWā¦can you believe I tried testing the image resolution thing by replacing all the 4320x4320px image files with 1000x1000px image files and sure enough the program started printing out NFTs?? Apparently the program canāt handle images that large. Is that normal, or is there some part of the code itself that can be changed to allow it to work with larger image files? Iām asking because all my image layers are large and Iād have to somehow figure out how to downsize them all.
Also yes, I have all my image layers needed for my own original NFT collection. I replaced all the original project images with my own original artwork.
maybe it is a limitation in the library that tries to process those images
It is good to know that at least now it works for 1000x1000px resolution
you could try 2000x2000px to see if it works
Yeah that sounds like possibility. Iām going to try upping the resolution to 2k x 2k and then flat 4k x 4k and see if it still works. Iāll get back in a bit to update you.
This is even more surprising. So what I did this time was copy all my original 4320x4320px images into another folder as a backup. I then went into the input file, deleted all the layer folders, went back to copy my original 4320x4320px images and their respected folders and then pasted them back into the input fileā¦sure enough itās now printing 4320x4320px NFTsā¦This is so weird. So the fix all this time was backup the input layer image folders into a different spot, delete the layer files in the input folder, and then copy, re-paste the backup files back into the input folder, or maybe it was getting the program to run with the 1000x1000px image files first which fixed something in the program that enabled it to print the original filesā¦I donāt know if it was the chicken or the egg, but itās definitely pumping out 4320x4320px NFT images now which was what I originally had in there to begin with. Crazy how it took this long to find such a simple fix that had nothing to do with the code or defining a directory which was what the error originally said was the issue.
The images might have became corrupt for whatever reason.
Actually itās giving me the error again because I didnāt notice I mixed in some 4000x4000px images with the 4320x4320px images so itās not conclusive yet. Itās definitely printing out 4320px files, but Iām not sure if itās actually reading 4320px files, or maybe if it has to do with the actual file sizes somehow. I do think it has something to do with the images being corrupted though. Iām going to tinker a bit more. Iāll give an update after Iām done.
Yes! I found the culprit and this is now fixed! So what was happening was, in one of my layer folders for āBase_headā I had 5 folders for the 5 different rarity levels, however I only have 2 base head options so I had an image in ācommonā, an image in ālegendaryā and left the other 3 rarity folders empty for the āBase_headā layer since I had no other base heads. I thought it didnāt matter if a folder for a certain layer rarity was empty. So I tested to see if that was an issue by filling the other 3 rarity folders with the same image for the ācommonā rarity ābase headā -> so rarities ācommon, uncommon, rare, and super_rareā get the same image and then I kept the 2nd image in the legendary rarity folder. This seems to fix it, I can now use all the original 4320x4320px images and their respective folders and itās pumping out NFTs again at that resolution.
In short, if you have your layer folders, with various rarity folders in each of them, then you need to make sure you have at least one image in every folder. You canāt leave any folder empty or else it wonāt run due to not being able to find an image in said folder.
Hi Eli, thanks for posting the issue here. I was facing a similar problem and managed to resolve the issue through this thread.
I have however 2 more problems, I wonder if you faced these or if you or anyone can help with these. (Sorry Iām new to coding ).
-
My first problem is that Iām not getting any JS file corresponding to each image
-
My second problem is that I get an error regarding the Moralis APIKey, which I assume is the reason Iām not getting any links to the images that were generated and there are no files on my Moralis server. The error says:
C:\Users\user\Desktop\moralis-mutants-nft-engine-main\index.js:83
apiKey,
^
ReferenceError: apiKey is not defined
at startCreating (C:\Users\user\Desktop\moralis-mutants-nft-engine-main\index.js:83:5)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The error refers to Line 83 which is about API Url. Where do I get the API URL?
Thanks!
You may need to put an url for api url and not an api key, but somewhere you should also put the api key
Thanks cryptokid. Just managed to get it working. I found the URL and the corresponding xAPI