Adding palette to sprite problems

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Adding palette to sprite problems

Post by Erato »

I am still attempting to compile the same grf as my previous posts. This time, the console complains about the palette:

Code: Select all

***\nml>nmlc -c --grf grf.grf ENRVS.nml
←[Knmlc ERROR: Image file "grf\Citea.png": 8bpp image does not have a palette
Included from: "ENRVS.nml", line 16
*Adds palette*

Code: Select all

***\nml>nmlc -c --grf grf.grf ENRVS.nml
←[Knmlc ERROR: Image file "grf\Citea.png": Palette is not recognized as a valid
palette.
What palette do I need to use? I tried to use a few, but none of them worked.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Adding palette to sprite problems

Post by Transportman »

You need the correct palette from here. Which palettes did you try?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Adding palette to sprite problems

Post by Erato »

The ones from Purno's tutorial.
However, with those (from the wiki), I'd have to install GIMP. NVM, that doesn't work at all.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Adding palette to sprite problems

Post by Erato »

Good, I didn't get any further. I couldn't find ANYWHERE how to add a palette to a file. It seems as though it has to be added right into the image, since the programme seems to respond to that. What do I have to do? ?( Please, help.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Adding palette to sprite problems

Post by Eddi »

so, which image program are you using?
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Adding palette to sprite problems

Post by Erato »

Paint.net
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Adding palette to sprite problems

Post by Sylf »

I don't see anywhere on Paint.NET how you can apply any palette to an image. When I loaded one of the OpenTTD paletted images in Paint.NET and saved as different name, the original palette was replaced by some random palette.

Can you show us what you did in Paint.NET, and post the image produced?

Paint.NET perhaps is not capable working with a specific palette. And if not, it's not the right program for this job.
User avatar
kamnet
Moderator
Moderator
Posts: 8589
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Adding palette to sprite problems

Post by kamnet »

Paint.net doesn't support pre-loading a certain pallet of colors. As long as you ONLY use the colors that OpenTTD supports, Paint.net works fine. If you save with anything outside that range, you'll get issues. It may be easier to use GIMP and load your pallet first.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Adding palette to sprite problems

Post by Alberth »

Gimp is not very intuitive to use for pixel editing.
It can apply a palette afterwards though, afaik.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Adding palette to sprite problems

Post by Erato »

Can someone answer my question, rather than complain about me using Paint.net?
Image file:
Image
Also, how do you attach a palette to a file, then? I couldn't find anything of the matter in the manual. I added a palette to GIMP, but that's as far as I got.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Adding palette to sprite problems

Post by planetmaker »

Erato wrote:Can someone answer my question, rather than complain about me using Paint.net?
Image file:
Image
Also, how do you attach a palette to a file, then? I couldn't find anything of the matter in the manual. I added a palette to GIMP, but that's as far as I got.
Getting the palette right can be a pain, even with the right tools. And even when you do not want to hear it: your tool is crap. Take the advice or leave it be, but then do not insult us; our advice is free and an earnest attempt to help you which does not deserve scorn.

As far as I could establish some time ago - and obviously the others do agree here - the answer seems to be "do not use paint.net" but use a programme which does support usage of palettes.
This does show how to apply a palette in gimp: http://docs.gimp.org/2.6/en/gimp-image- ... dexed.html - Mind to use a custom one and use the correct one as e.g. found shipped with NML or at http://dev.openttdcoop.org/documents/1 Do *NOT* remove unused colours from the image when saving.
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Adding palette to sprite problems

Post by Sylf »

FWIW, I wasn't complaining your use of Paint.NET. I was saying that I couldn't find a way to preserve the specific palette information when saving a file using Paint.NET. But I'm not as experienced with it, so I wanted to see what you were exactly doing to generate the image using one of the newgrf palettes.

Anyway. I saved your image, and did the following to apply the newgrf DOS palette, using GIMP Portable on Windows (the only program I have available right now):
=> Save one of the palette files from the page transportsman linked
=> Import the palette to GIMP
==> Open the Palettes dockable window by going Windows / Palettes
==> Find the Palette menu (see attached image), and go to Palettes Menu / Import Palette
==> When the Import Palette dialog opens, pick Palette File, and click Import button
=> Open the image in work, TiB53M6.png
=> Switch the color space from paletted to RGB.
==> Image / Mode / RGB
=> Apply the NewGRF palette that I imported earlier
==> Image / Mode / Indexed
===> Chose "Use custom palette
===> Chose the palette we just imported
===> Uncheck "Removed unused colors from color map"
===> Click Convert

When GIMP applies the palette to the image, it may use one of the animation colors. You will probably need to use other tools to verify and adjust the image as needed after the conversion.
Attachments
palette menu.PNG
palette menu.PNG (12.32 KiB) Viewed 2556 times
apply palette.PNG
apply palette.PNG (39.84 KiB) Viewed 2556 times
User avatar
kamnet
Moderator
Moderator
Posts: 8589
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Adding palette to sprite problems

Post by kamnet »

And I'm also a daily user of Paint.Net, so certainly not complaining, just pointing out that it's not the best tool to finish off your sprites. I typically start in Paint.Net because I find it much easier to work with, then I'll save my files, import them into GIMP, apply the TTD palette and save.
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Adding palette to sprite problems

Post by Erato »

kamnet wrote:And I'm also a daily user of Paint.Net, so certainly not complaining, just pointing out that it's not the best tool to finish off your sprites. I typically start in Paint.Net because I find it much easier to work with, then I'll save my files, import them into GIMP, apply the TTD palette and save.
Sylf wrote:FWIW, I wasn't complaining your use of Paint.NET. I was saying that I couldn't find a way to preserve the specific palette information when saving a file using Paint.NET. But I'm not as experienced with it, so I wanted to see what you were exactly doing to generate the image using one of the newgrf palettes.
No, I meant that your comments earlier didn't really help me. I was afraid that I might've said it a little too harsh, but not as harsh as to have report-fodder thrown in my face:
planetmaker wrote:Getting the palette right can be a pain, even with the right tools. And even when you do not want to hear it: your tool is crap. Take the advice or leave it be, but then do not insult us; our advice is free and an earnest attempt to help you which does not deserve scorn.
I appreciate the help, but not the insulting language you use there.
Sylf wrote:Anyway. I saved your image, and did the following to apply the newgrf DOS palette, using GIMP Portable on Windows (the only program I have available right now):
=> Save one of the palette files from the page transportsman linked
=> Import the palette to GIMP
==> Open the Palettes dockable window by going Windows / Palettes
==> Find the Palette menu (see attached image), and go to Palettes Menu / Import Palette
==> When the Import Palette dialog opens, pick Palette File, and click Import button
=> Open the image in work, TiB53M6.png
=> Switch the color space from paletted to RGB.
==> Image / Mode / RGB
=> Apply the NewGRF palette that I imported earlier
==> Image / Mode / Indexed
===> Chose "Use custom palette
===> Chose the palette we just imported
===> Uncheck "Removed unused colors from color map"
===> Click Convert

When GIMP applies the palette to the image, it may use one of the animation colors. You will probably need to use other tools to verify and adjust the image as needed after the conversion.
Ty, this helped, a bit.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 63 guests