Grit/image exportation help

  • Thread starter Thread starter elle-p
  • Start date Start date
  • Views Views 896
  • Replies Replies 11

elle-p

Member
Newcomer
Joined
Aug 28, 2025
Messages
13
Reaction score
2
Trophies
0
Age
20
XP
57
Country
United Kingdom
Yeah I have another issue. You fix one another makes itself known. This time with grit/image converting. Running it on the ds makes it print the error "File /palette/ui/01.pal not found. Error code 101.". I think I know what's going on, but I don't know how to fix it. BlocksDS automatically converts my graphics when compiling, but they're d, o, c, and h files, not the img and pal files needed for NFLib. I have .grit files with the same name as my graphics, but I don't think they're doing anything, and it's going to be very annoying to make them for everything.

I tried not using NFLib and just using LibNDS, and that also made me realise that my graphics export with the file extension still there. So I have A.png and A.grit next to each other, it exports as A.png.d, A.png.o, A_png.c, and A_png.h. Using naming everything related A_png still says that A_pngTiles doesn't exist, so trying that just gave another error, and it would be a lot nicer to use NFLib anyway.

Basically, how do you convert images in the right format to use for NFLib, and have those compile?
 
Hi, do you need .pal and .img files? have you tried this package?
I'm not sure how is it realised now in BlockDS makefile for compilation rule, but it was useful in devkitPro + NFlib.
Generaly there was two ways, add resources to NitroFS like commercial roms does and NFLib support by default.(.img/.pal)
or include them into main exactuable, like in devkitPro libnds examples (.d.h.o.c), for tiny homebrews up to 4MB.
for NFlib you don't need .png and .grit files, only .pal and .img which those bat files could help you to get.
for libnds you need only .png and .grit with build rules like in very first libnds/devkitPro examples.

Please check girt parameters that are located in convert.sh examples
https://github.com/knightfox75/nds_nflib/blob/master/examples/graphics/sprite/assets/convert.sh
 
Last edited by plasturion,
  • Like
Reactions: bonkmaykr
Can you elaborate on how to use that? And, once converted, how to link them to the compiler?
 
I don't have BlocksDS, so I can't check however the example doesn't changed much, so it should work.
Create "nitrofiles" directory and place there your .img and .pal files same like convert.sh says.
Does any example of the NFlib / DSlib compile for you succesfully?
It should, if not maybe someone else can help here better.
Maybe something was missed during instalation of SDK / wonderful toolchain?
 
I copied the NitroFS initialisation a bit more faithfully to the examples, and it's now found the pal files, so that's one problem sorted!

But, I still don't know how to convert the files with grit. I made the pal files with usenti, but that has no support for img or map files. So how do you use grit to make the files? Is it a commandline, or do you just drag the files onto the exe(which just gives h and s files). All the examples have the files already converted, and the installation has no instructions.
 
Have you clicked the nested post i atached before?
there's a package grit.7z with bat files (parameteres for commandline) for various graphics like cmaps, backgrounds or sprites.
If you like to convert sprites, just place sprites images in .bmp format into bmp directory as bat says, or edit this bat and change the line with grit to .png if you like to use pngs.
I recommend to open bat files and try to inspect what they do, they are very similar to linux terminal convert.sh, probably you can change few things to make corresponding .bat from .sh file if you like to use windows.
here is the list of grit directive parameters:
https://www.coranac.com/man/grit/html/grit.htm
 
I'm trying to do this with a basic background, but it keeps saying the file either can't be found or can't be read, whether I put a .bmp or .png into the bmp folder.
 
So I'm guessing you are using convert_backgrounds.bat.
If you run bat files first time that statements can appear because first what converter is trying to do is to clean up and delete all files that may in fact no exist yet, so no issue here or big deal.
Well is there any result while converting in "background" output folder? like "filename.img"
Probably if there's only that one file probably you need to change bit depth to 8-bit first.
As said before try inspect what converter is trying to do and describe more detailed infos.
 
  • Like
Reactions: Rolyando
I made sure to use a screenshot from a gbc game so that the initial image should be 8 bit, and I added -gB8 to the grit options in convert_backgrounds.bat. It still just says (after mentioning that it can't find any stuff in the backkgrounds folder to clean up- those lines go away if I remove the .bat instructions to delete them but the rest is the same)
"ERROR: "bmp\boy.png" not found or can't be read.
grit.exe bmp\*.png -g -gB8 -gTFF00FF -p -ftb
File Not Found
A duplicate file name exists, or the file
cannot be found."
The last part repeats 2 more times. The fact that it knows the exact name of the image I put in bmp makes me feel like the file was obviously found but can't be read for some reason. I don't know what I'm doing wrong. There's nothing in the backgrounds folder.
 
Not sure why it really does, I remember I couldn't open newer png files in older graphic software, now I wonder if is the same reason for grit, if png fails try to use bmp then. Your image could have only one color and still be unexpected 32 bit on default windows printscreen, however at least one .img file should appear in background folder. I don't think -gB8 parameter help here if input image is not exactly 8bit. I used that bat file before and it always worked for me, also tested again and converts fine. I wonder if your image may be also different format with invalid extension. You still can check in file propeties on right click or re-save it in any graphical editor like Gimp or older but golder intuitive Jasc Paint Shop Pro 7.04 trial what i'm using.
Also now i see my bat has two grit lines one was commented with echo and should be ignored.
You need only that one " grit.exe bmp\*.png -g -gTFF00FF -m -mRtf -mLs -p -ftb " so probably you don't need to change anything from the package or at least don't bother "echo lines". That grit line for sure create also needed .map file. Sorry for little mess.
If you want to make sure try to look for convert.sh on NFlib github repo.
 
  • Like
Reactions: Rolyando
Ok so after a huge amount of trial and error, I tried putting in a screenshot image and grit finally works now. I think it was just the wrong format for one reason or another, probably the bitdepth like you said. Thank you so much for your help
 
  • Like
Reactions: plasturion

Site & Scene News

Popular threads in this forum