Finding Optimal Color Palette for Image

Aerisetta

Active member
Hello

So I usually create characters in full color range, then I go to GIMP and turn it into an indexed color mode. However, this is very random and the computer picks palette choices I usually disagree with, so I need to increase the number of colors to cover everything.

For example, here is the image I'm trying to index. I think 20ish colors should be enough, but for some reason GIMP will not register the red in the mouth unless i make it 80 colors, very random.

Anyone have a better process?

test.png
 
Don't know enough about Gimp, but I assume it has multiple interpretation options like Photoshop (i.e. Perceptive, Restrictive, Web only, etc.). Maybe play around with those.

Otherwise, who gives a crap what the palette of your sprites are as long as they match? Just think of it like a smart palette. Once you've got all the sprite set images on a uniform color table, define a default palette and alternate palettes by hand, and that's what the player sees.


DC
 
Hi, The problem is that the number of red pixels are too few compared to other colors, the optimization algorithm looks for the most used colors in the image, not those that are most striking to the human eye.
Note :Not only are they few, but they are also very similar tones to others that appear in the armor.

Better use the "use a custom palette" option, you need select a good base palette.
Gimp by default doesn't come with many palettes (it's meant to be an RGB editor, not a pixelart program after all), but you can download palettes from the internet or create your own.

For example, with web-only palette:



You can also use your own optimized palette, for example you could choose 255 colors for your entire game, save those colors to one palette, and then index the image based on that single palette.


If you don't want to limit the number of colors for the whole game, you can create the palette for each entity, for example:

I took your image, duplicated it, used the "generate optimun palette" option with 20 colors over the duplicated image.
The resulting palette, I manually edited, adding the colors you think were missing, for example I added 2 extra colors for the mouth.

I go back to the original image, and index it, using this new palette:
 
Last edited:
The problem converting images like this is there is too many shades of colors that are almost identical. So concentrate on consolidating those colors. Like the skin will be easily done in 3 or 4 shades, less if you wanted. Not sure about GIMP, but in photoshop when I have something like this I will force some of the most important colors (if not all of them) into the palette so it will choose the ones I want with priority. In the example there is a forced color for the skin, photoshop will force all the similar ones to this color if the amount of colors is low enough to prevent it adding extra.

testest.png

This is just an example of me building the palette while converting to indexed. What you would really want to do is build the palette beforehand and save that as .act file. Then force apply that palette when you convert the images. Say you provide 16 colors in the saved palette then limit to 20 during conversion it will only have 4 more palette entries to make up the rest of the missing colors. So try to add few add shades from light to dark for each part of the sprite. Like Skin, hair, clothes, etc.

You use Palette: Master (Adaptive), Forced: Custom...

choose the amount of colors to force it to, in the example it's 20. For this sprite you really just need 3 to 4 shades for each color or less. Like 3 to four for the skin, some shades of blues for pants and shoes, brown for hair etc.

It's not super fast but if you take the time to build a good palette it should turn out really well. Just doing a quick test I got the skin and lips looking perfect with about 5 colors. The harder part is the weapon, you will need to spend more time to get it nice..

PS - The original sprites looks like it shouldn't have many colors thou, but they were converted to JPG or something at one time. Are you sure there isn't better rips of them available? or maybe there's a way you can rip them yourself from the original game.
 
Last edited:
Aerisetta is making 'em themselves, by taking pngs of characters in unity. The effect is cool and they look like they should come from a game with a strict palette, but boy do they not, it's on unity. I ran into this issue myself when I tried something similar, too many colors got dedicated to dumb stuff and thus things like facial expressions couldn't show well. Forcing the palette to care about what you want it to is the only option here!
 
Last edited:
it's on unity

Ahh, there's your problem. Screen caps are probably the worst possible way to get assets from a modern engine (OpenBOR included). There are so many special effects, filters etc. going on you have less than 0 chance of getting a clean rip of the real asset.

I would suggest looking about for orginals - really deep dive for them. Most Unity game assets are out there somewhere. They're going to look really weird because Unity's palette system is designed more for textures than flat sprites, but it's much easier in the long run than trying to rip and hand edit the resulting mess.

DC
 
Having colors that are more than 256 for indexing is my weakness right there. (I know it's limited to 256 colors total if you set all.)

The first one is my edit and the other one is the original. The first one is all 256 colors, but I set mine to 255 with GIMP for saving space for the background color. How can I make the original not mess up colors if I set to 255?
 

Attachments

  • round_1.png
    round_1.png
    26.1 KB · Views: 2
  • round_1.png
    round_1.png
    34.2 KB · Views: 2
Back
Top Bottom