[SOLVED] ENOENT Error, Path undefined, syscall fopen

it looks like loadLayerImg function maybe fails to load a specific image file

1 Like

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?

1 Like

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

1 Like

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.

1 Like

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.

1 Like

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

1 Like