Page 1 of 1

New GRF Help!

Posted: 05 Jun 2019 12:05
by Trolley Trev
Hi all.

I'm not sure if this is the right forum to post or whether it would be better in tech discussion, but...

I am currently working on my first ever New GRF but I have a little problem... I can't get it to compile! I am coding in NML and using the nmlc tool to (attempt to) create the .grf file.

So far, all the coding errors that have come up on compile I have been able to fix, but it keeps throwing up a "Cannot identify image file" error. The only time I was able to get it to compile successfully was when out of frustration I made the entire .png file "transparent" blue.

I created the PNG in Paint.net (using the right colours in the DOS palette) but after realising it couldn't create the required paletted file, I downloaded GIMP and the DOS palette for it. I then imported my PNG file into GIMP and converted it to indexed. For the life of me, I just can't figure out what's wrong with it!

I have attached the PNG file if anyone has any ideas!

Thanks in advance for any insights!

Re: New GRF Help!

Posted: 05 Jun 2019 14:28
by juzza1
Your png file is malformed enough for Pillow (the image library used by nmlc) to complain about it. Pillow is usually pickier than image viewers, so it still renders in Gimp and other programs. Re-exporting your image as png in Gimp (2.10.10) fixed the problem on my machine.

Edit: I managed to get the error myself by selecting both "Save color profile" and a combination of other export settings in the Gimp png export dialog. It's probably related to this bug: https://gitlab.gnome.org/GNOME/gimp/issues/2111. Uncheck "Save color profile" if you had it enabled.

Re: New GRF Help!

Posted: 05 Jun 2019 21:48
by Trolley Trev
Ok, I will try it out tonight when I get a chance. Thankyou for your help. :))

Re: New GRF Help!

Posted: 06 Jun 2019 01:24
by kamnet
As an alternative, you could also try coding your NewGRF for 32bpp, which basically gives you a 24 million color palette, and should thus end the complaints. :)

Re: New GRF Help!

Posted: 06 Jun 2019 11:19
by Erato
kamnet wrote:As an alternative, you could also try coding your NewGRF for 32bpp, which basically gives you a 24 million color palette, and should thus end the complaints. :)
You'd still need to provide 8bpp sprites so you just added more complexity, instead of removing it.

Re: New GRF Help!

Posted: 06 Jun 2019 11:36
by Pyoro
Also, with saving in GIMP, don't forget to turn off "remove unused and duplicate colors" (or something to that effect) when switching modes to Indexed. That saves only the palette color actually used instead of the full palette, which causes NML to complain about incorrect palette.

Re: New GRF Help!

Posted: 07 Jun 2019 00:51
by kamnet
Erato wrote:
kamnet wrote:As an alternative, you could also try coding your NewGRF for 32bpp, which basically gives you a 24 million color palette, and should thus end the complaints. :)
You'd still need to provide 8bpp sprites so you just added more complexity, instead of removing it.
Well, only if you care about company colors...

... which, now that I think about it and looked at the graphics, probably does care about it...

... ooops. :P

Re: New GRF Help!

Posted: 07 Jun 2019 22:22
by Trolley Trev
I re-exported without color management as you suggested and that fixed my problem. Many, many thanks! :bow: