AuthorTopic: What is best 256 color palette?  (Read 42965 times)

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

What is best 256 color palette?

on: September 01, 2015, 02:54:55 pm
I want to know what is best 256-color palette. Not all entries have to be occupied.
I know these:
* Subset of 10-10-10 level RGB (1000 colors). First 125 colors are combinations of 5 levels of RGB each with LSB off. Next 125 are same, but with LSB on. For total of 250 colors, 6 remain.
* Subset of 16-16-16 level RGB (4096 colors). The format is IIRRGGBB: R, G and B are two most significant bits of each component, while I sets 2 LSBs of each component.
* Another IIRRGGBB format palette, but I sets color brightness to 25, 50, 75 or 100 percent of original. There is more fidelity in darker colors, but there is some redundancy: blacks, and 66% red with 50% brightness is same as 33% red with 100% brightness.
* 256-level grayscale for full brightness fidelity but no color/saturation fidelity at all. Variant: 128-level grayscale and fill remaining 128 colors to compensate for human's limited vision (human sees 21-bit RGB, not 24-bit).
* Level combination: each of 4-16-4, 8-8-4, 6-6-6, 6-7-6, 6-8-5, 7-7-5, 5-9-5, 5-10-5 and others for RGB are accepted.
* As above, but for hue, saturation, value/light. NES tried this.
* 2 bits for red/blue, 3 bits for green. Other bit is LSB of red and blue.
* Make four cubes of 64 colors, where there are 4 RGB levels in each cube chosen from 8 levels. Example: 0-2-5-7, 0-1-2-3, 2-3-4-5, 4-5-6-7. Configurator link: http://drag.wootest.net/misc/8bit_rgb.html
* To reduce large RGB bit-based palette by 2 bits, merge LSB of red, green and blue to one bit, as long as they all exist. If there are only two normal components with their own bits, you can only merge them to compress by 1 bit. This preserves all grays of palette (only if there are equal bits of each component), but reduces hue/saturation fidelity.

Here are samples for some of them:
Uniform HSV selection: There are 15 hues, 2 saturations, 9 values in full saturation, 7 values in half saturation, 17 grays and some transparency.

Uniform RGB selection: There are 4 bits for each component, where 2 least significant bits are shared between components. As a result, there are 2 bits for each component and 2 least significant bits shared between components. There are 18 hues, 2 saturations and 16 values. Best case precision is 12 bits, while worst case precision is 6 bits.
Format: RRGGBBSS
In other words, it's 4 RGB cubes, where each RGB component can be any of following values:
  • 0, 68, 136, 204
  • 17, 85, 153, 221
  • 34, 102, 170, 238
  • 51, 119, 187, 255
Example: 255, 119, 51 (orange)
« Last Edit: September 30, 2015, 03:23:31 pm by Piotr »

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #1 on: September 02, 2015, 12:31:24 am
Wouldn't the best palette be a hand-picked one? 256 is way more colors than you'd ever need I feel. A unified 32 or 64 color palette should be plenty to do an entire game in.

Offline Streaksy

  • 0001
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #2 on: September 02, 2015, 02:41:09 am
I've tried several algorithms to populate a palette, and there's no universally perfect way.  Evenly distributed RGB over 256 colours can make some things look pretty good and other things ugly.  It depends what it's for.  If you can't predict it's use like you were building a games system, then, yeah, you'd probably generate something that covers the RGB combination range in as many steps as you can based on palette size.

Then there's hand-picking colours and maybe adding them as needed.

The old default VGA palette was based on being organised rather than universal...

Or.. if it's for a game... something I've done a few times to reduce filesizes... make the art largely in 24bit without colour constraints, put all the artwork in one image canvas and reduce the colours to 8 bit / 256 colours, and see what you have.  That's just technical, though.  It doesn't really answer your question of a single perfect palette.  ;/  If you really must work with 256 colours for some reason but want freedom of design, that's probably the way.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #3 on: September 02, 2015, 11:20:53 am
I've tried several algorithms to populate a palette, and there's no universally perfect way.  Evenly distributed RGB over 256 colours can make some things look pretty good and other things ugly.  It depends what it's for.  If you can't predict it's use like you were building a games system, then, yeah, you'd probably generate something that covers the RGB combination range in as many steps as you can based on palette size.

Then there's hand-picking colours and maybe adding them as needed.

The old default VGA palette was based on being organised rather than universal...

Or.. if it's for a game... something I've done a few times to reduce filesizes... make the art largely in 24bit without colour constraints, put all the artwork in one image canvas and reduce the colours to 8 bit / 256 colours, and see what you have.  That's just technical, though.  It doesn't really answer your question of a single perfect palette.  ;/  If you really must work with 256 colours for some reason but want freedom of design, that's probably the way.
It does not matter it looks ugly in some objects. I just want to know the best one, not actually doing art (if art, then only for testing the palette)

Offline yrizoud

  • 0010
  • *
  • Posts: 330
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #4 on: September 02, 2015, 12:49:46 pm
If there was a best one, there would be no reason to use any other palette, right ?

In general, if you're striving to "compute" a versatile palette, you should rather try split the HSV / HSL spaces than the RGB cube. There are some very large areas of these cubes where you don't need a lot of detail, but they are more easy to describe/define/compute according to HSL : Ex. "the more saturation increases, the more hue is important" and "as the color approaches maximum and minimum lightness, hue and saturation become irrelevant"

(human sees 21-bit RGB, not 24-bit)
Where did you hear that ?

Offline Cyangmou

  • 0011
  • **
  • Posts: 929
  • Karma: +3/-0
    • cyangmou
    • http://pixeljoint.com/p/32234.htm
    • cyangmou
    • View Profile
    • Pixwerk Homepage

Re: What is best 256 color palette?

Reply #5 on: September 02, 2015, 01:36:08 pm
Wouldn't the best palette be a hand-picked one? 256 is way more colors than you'd ever need I feel. A unified 32 or 64 color palette should be plenty to do an entire game in.

yeah I agree, handpicked palettes are the best.

Would say 256 is easy to exceed without caring about color limits. Games like modern castlevania etc. exceed that.
However palettes have more to do with contrasts and color intensity. You can't evenly distribute them because the numbers on the scales don't match up with the human impression of color (red always looks stronger than blue)

An unified also palette has it's pros and cons.
While an unfied palette allows you to produce quite fast it gets really hard with capturing exact light effects, which greatly can liven up your art in terms of mood and atmosphere.
And color is anyways an balancing act. THere are no ugly colors,just ugly combinations of them.

picking/choosing your own colors will learn you how colors exactly work in the long run. That's quite an interesting journey.
"Because the beauty of the human body is that it hasn't a single muscle which doesn't serve its purpose; that there's not a line wasted; that every detail of it fits one idea, the idea of a man and the life of a man."

Dev-Art
Twitter

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #6 on: September 02, 2015, 03:34:51 pm
If there was a best one, there would be no reason to use any other palette, right ?

In general, if you're striving to "compute" a versatile palette, you should rather try split the HSV / HSL spaces than the RGB cube. There are some very large areas of these cubes where you don't need a lot of detail, but they are more easy to describe/define/compute according to HSL : Ex. "the more saturation increases, the more hue is important" and "as the color approaches maximum and minimum lightness, hue and saturation become irrelevant"


I know about using HSL/HSV spaces instead. Anyway, thanks for a hint!

Quote from: Piotr
* Level combination: each of 4-16-4, 8-8-4, 6-6-6, 6-7-6, 6-8-5, 7-7-5, 5-9-5 and others for RGB are accepted.
* As above, but for hue, saturation, value/light. NES tried this.

YIQ color space may give best results.

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #7 on: September 02, 2015, 07:08:23 pm
I personally would do what Arne did. Get a bunch of reference images, calculate a palette out of that, sorted by which colors show up most. Maybe write a program that collects all palette entries for an image, throw in a bunch of classic pixel art, then use an algorithm to reduce to 256 colors?

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #8 on: September 03, 2015, 11:21:23 am
I've tried it. My results with K-means clustering of LAB or LCH colorspaces were 'best', but still not all that satisfactory.

Currently, HUSL seems like the best colorspace for attempting to programmatically derive a palette from. HSY is simpler but also less well optimized (in terms of maximizing difference between colors), though it is better than HSL.

I've tried YIQ and YCbCr, IMO they are better than RGB but otherwise fairly unremarkable.

I recommend entirely ignoring HSV: it is possibly the worst colorspace I've encountered in terms of providing meaningful measures of difference between colors.

Finally, if you're going to do what Gil suggests, keep in mind the algorithm you use for reduction. Most palette reducers use some kind of median cut, which generally reduces contrast by minimizing extreme values, so consider increasing contrast before reduction, to compensate.
« Last Edit: September 03, 2015, 11:27:11 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #9 on: September 03, 2015, 04:49:29 pm
I've tried YIQ and YCbCr, IMO they are better than RGB but otherwise fairly unremarkable.
My reason for using YIQ rather than YUV or YCbCr is that bounds of YIQ mean that eye is less sensitive to Q than I, so it's compressed more which allows to increase overall. For YUV, U and V would require about same values as Y to achieve similar color fidelity (same for YCbCr).

Offline DawnBringer

  • 0001
  • *
  • Posts: 51
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #10 on: September 04, 2015, 06:05:36 pm
Define "Best".

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #11 on: September 04, 2015, 07:14:13 pm
Define "Best".
Go to school! I need people to know how many grays, how much extent these colors are needed, etc. and you don't know what is even best for general use!!!

Offline RAV

  • 0010
  • *
  • Posts: 293
  • Karma: +0/-0
    • View Profile
    • Blackbox Voxel Tool

Re: What is best 256 color palette?

Reply #12 on: September 04, 2015, 09:38:42 pm
*sigh* I have an interest in this discussion, and if possible, I'd like it to somehow stay productive and informative.

Piotr is very young and new here. He did try and prepare himself for this though. Now he stumbled a bit. Maybe we can figure a way to keep it cool.

He seems to be looking for a straightforward solution and definite answer. The people that have posted here have a lot of experience with thinking colour spaces and palettes, technically and artistically. And DawnBringer has created general purpose palettes that are useful and popular. This includes a 256c palette. In his method of crafting them there are a lot of considerations. But even he knows there is just so much you can account for. In the end it's particular requirements and taste that dictate what's best. Maybe, if anything, it's a certain set of (sub?)palettes that's "best", together designed to cover a range of specific common applications, at least. Or we can take into account how conveniently the palette can be customized and extended. Can there be a versatile palette "seed" as system palette?


« Last Edit: September 04, 2015, 10:59:10 pm by RAV »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #13 on: September 05, 2015, 01:37:17 am
Define "Best".
Go to school! I need people to know how many grays, how much extent these colors are needed, etc. and you don't know what is even best for general use!!!
School won't help you define what palette is 'best'. There isn't such a thing as a universally 'best' 256-color palette, and the reason for that is that 256 colors is so much smaller than the number of colors people can distinguish between.
Like anything else, there are palettes that are 'best' for a specific purpose, and the more specific you can be, the closer you can approach 'best' (selecting colors that suit your application well).
How many greys are needed depends on application; what colors are needed and to what extent depends on application. etc.

If you will not define a specific application for the palette, there is no best palette, not even in theory.
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #14 on: September 05, 2015, 09:09:57 am
Define "Best".
Go to school! I need people to know how many grays, how much extent these colors are needed, etc. and you don't know what is even best for general use!!!
School won't help you define what palette is 'best'.
He doesn't know about what is anything best. Not only palettes. He just doesn't know meaning of word "best" itself. For DawnBringer, here you go: http://www.urbandictionary.com/define.php?term=Best&defid=5047406 (use definition 1)
« Last Edit: September 05, 2015, 09:15:19 am by Piotr »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #15 on: September 05, 2015, 09:25:11 am
That is not what he was saying. As his post history demonstrates, he is quite capable at using the English language.
« Last Edit: September 08, 2015, 12:51:05 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline happymonster

  • 0010
  • *
  • Posts: 455
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #16 on: September 10, 2015, 06:48:03 pm
It also depends if you want to use the colours with dithering or not. For example a made a 256 colour palette designed for full HSV dithering (via a program) that gives good colour reduction results with a lot of dithering, but wouldn't be great to use without it..

Offline Seiseki

  • 0011
  • **
  • Posts: 915
  • Karma: +1/-0
  • Starmancer
    • OminuxGames
    • http://pixeljoint.com/p/35207.htm
    • StarmancerGame
    • View Profile
    • Starmancer Patreon

Re: What is best 256 color palette?

Reply #17 on: September 13, 2015, 11:26:47 am
Piotr don't be a dick.
Especially when you're the one asking for help..

Offline lachrymose

  • 0010
  • *
  • Posts: 345
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #18 on: September 13, 2015, 12:54:06 pm
@Seiseki: Considering it has been almost 10 days since Piotr has posted, I think your comment is past due in its context and it just feels like you are trying to instigate something.

Offline Seiseki

  • 0011
  • **
  • Posts: 915
  • Karma: +1/-0
  • Starmancer
    • OminuxGames
    • http://pixeljoint.com/p/35207.htm
    • StarmancerGame
    • View Profile
    • Starmancer Patreon

Re: What is best 256 color palette?

Reply #19 on: September 14, 2015, 02:05:16 am
I just saw the 'new post' icon, never looked at the date..
Honestly I felt like everyone was just tiptoeing around, which is why I said 'don't be a dick'.

But yeah you're right, I shouldn't have said anything.. :blind:
« Last Edit: September 14, 2015, 05:34:17 pm by Seiseki »

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: What is best 256 color palette?

Reply #20 on: September 14, 2015, 05:09:09 pm
This is a pretty nonsensical question, simply because there is not a one fits all scenario. Look at old VGA DOS games. Those have a palette of 256 colours at once. Some of them do clever stuff to change colours between levels and other things.

Dor example, look at Doom, Heretic, or Quake. Those games all only have 256 colours on screen max at any given time, but they have very different atmospheres. And that has a lot to do with which colours were picked by the artists. In general when it comes to making games for art you should always develop your palette with your intended assets and the game as a whole in mind. What feelings to you want to evoke, what things are important to stand out, how do you guide the player (can be done with colours and lights for example, etc.
There are no ugly colours, only ugly combinations of colours.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #21 on: September 30, 2015, 03:56:19 pm
I've tried it. My results with K-means clustering of LAB or LCH colorspaces were 'best', but still not all that satisfactory.

Currently, HUSL seems like the best colorspace for attempting to programmatically derive a palette from. HSY is simpler but also less well optimized (in terms of maximizing difference between colors), though it is better than HSL.

I've tried YIQ and YCbCr, IMO they are better than RGB but otherwise fairly unremarkable.

I recommend entirely ignoring HSV: it is possibly the worst colorspace I've encountered in terms of providing meaningful measures of difference between colors.

Finally, if you're going to do what Gil suggests, keep in mind the algorithm you use for reduction. Most palette reducers use some kind of median cut, which generally reduces contrast by minimizing extreme values, so consider increasing contrast before reduction, to compensate.
It's more important to provide equally spaced components, because it's possible to increase number of values for one component and reduce it for others. 6-8-5 values in RGB with gamma correction is good. I said YIQ may be best because it's better for reducing values. YCbCr, for example, includes all luminance information in one component, allowing for reduction of other components. In RGB, every component has varying degrees of luminance information, making using reduction giving more loss in palette. Still, green includes most luminance information.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #22 on: September 30, 2015, 10:52:49 pm
I'd generally suggest that best (most accurate summarization of original colors) reduction performance is achieved with a perceptually-tuned colorspace like LAB. And I must point out that having all luminance information in one channel is a goal it achieves. Not perfectly IMO, but noticably better than YCbCr or YIQ, which was an earlier and simpler technology.

However, if you are generating colorcubes, as your comment about 'equally spaced values' suggests, this is a completely different situation from reducing colors, and I'll stand by my comment of HUSL being the best in this case (combines the merits of LAB and HSL).
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #23 on: October 01, 2015, 01:05:26 pm
Piotr, you seem to take a very "programmer"-style approach to all this. The stuff you suggest just isn't what an artist working with your palette would like to see. You'd end up with what a programmer would call an "excellent palette", leaving artists to scream at their screen. For example, almost any artist would prefer it if a palette worked well for creating assets, even if that meant components aren't spaced close to equally. For example, artist will probably shift colors from dark areas to light, so there's more indices in the lighter end of the spectrum versus the darker. This will make the art very crude in shadowy parts and that will make a programmer go "look at these artifacts in the dark end, that's just not right!", forgetting to take in account the fact that the lighter end of the art looks 5 times as good.

Also, I see you post stuff like this palette:


No artist on this forum would enjoy making games with this palette, apart from maybe a demo-scene-style curiosity.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #24 on: October 01, 2015, 02:50:10 pm
I'd generally suggest that best (most accurate summarization of original colors) reduction performance is achieved with a perceptually-tuned colorspace like LAB. And I must point out that having all luminance information in one channel is a goal it achieves. Not perfectly IMO, but noticably better than YCbCr or YIQ, which was an earlier and simpler technology.

However, if you are generating colorcubes, as your comment about 'equally spaced values' suggests, this is a completely different situation from reducing colors, and I'll stand by my comment of HUSL being the best in this case (combines the merits of LAB and HSL).
I said equally spaced values. Equally spaced means there is equal difference in each consecutive values of one component. For example, in 0, 128, 255, the 128 is closer to 0 due to gamma correction, and can be increased.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #25 on: October 01, 2015, 03:06:14 pm
Piotr, you seem to take a very "programmer"-style approach to all this. The stuff you suggest just isn't what an artist working with your palette would like to see. You'd end up with what a programmer would call an "excellent palette", leaving artists to scream at their screen. For example, almost any artist would prefer it if a palette worked well for creating assets, even if that meant components aren't spaced close to equally. For example, artist will probably shift colors from dark areas to light, so there's more indices in the lighter end of the spectrum versus the darker. This will make the art very crude in shadowy parts and that will make a programmer go "look at these artifacts in the dark end, that's just not right!", forgetting to take in account the fact that the lighter end of the art looks 5 times as good.

Also, I see you post stuff like this palette:
{placeholder}

No artist on this forum would enjoy making games with this palette, apart from maybe a demo-scene-style curiosity.
That image was just an attempt forgetting some things. For 256 colors question, I'm trying to combine the goals of programmer and artist perceptions. The images in first post showed example palettes, not intended to be candidates or good palettes. In RRGGBBSS format where S is shared least significant bit, very light/dark colors must be grays or be oversaturated. I really don't know if it's good enough. Does combining unique palettes of several games with about 30 colors each produce great results? (Unique means that colors in palettes are different enough to add up to 256 colors. Keep in mind that 256 color game can be reduced to 32 colors and still be usable.)
PS A 256 color palette fully hand-picked would take a lot of time and I am not very good in making hand-picked palettes.
« Last Edit: January 08, 2017, 03:49:50 pm by Piotr »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #26 on: October 01, 2015, 03:08:39 pm
I'd generally suggest that best (most accurate summarization of original colors) reduction performance is achieved with a perceptually-tuned colorspace like LAB. And I must point out that having all luminance information in one channel is a goal it achieves. Not perfectly IMO, but noticably better than YCbCr or YIQ, which was an earlier and simpler technology.

However, if you are generating colorcubes, as your comment about 'equally spaced values' suggests, this is a completely different situation from reducing colors, and I'll stand by my comment of HUSL being the best in this case (combines the merits of LAB and HSL).
I said equally spaced values.
So did I. Seriously, read my post. It says 'equally spaced values'. You quoted it.
I have no idea why you think you need to correct me on that.

Quote
Equally spaced means there is equal difference in each consecutive values of one component. For example, in 0, 128, 255, the 128 is closer to 0 due to gamma correction, and can be increased.
That is not what equally spaced values means, though. if 128 is increased to, eg. 130, then values are no longer equally spaced.

As far as I can see you are talking about generating an equally spaced gradient in Linear RGB, then converting it to sRGB (at which point, the gradient -looks- equally spaced to the eye, and the -values- are no longer equally spaced.).

If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #27 on: October 01, 2015, 03:14:15 pm
I'd generally suggest that best (most accurate summarization of original colors) reduction performance is achieved with a perceptually-tuned colorspace like LAB. And I must point out that having all luminance information in one channel is a goal it achieves. Not perfectly IMO, but noticably better than YCbCr or YIQ, which was an earlier and simpler technology.

However, if you are generating colorcubes, as your comment about 'equally spaced values' suggests, this is a completely different situation from reducing colors, and I'll stand by my comment of HUSL being the best in this case (combines the merits of LAB and HSL).
I said equally spaced values.
So did I. Seriously, read my post. It says 'equally spaced values'. You quoted it.
I have no idea why you think you need to correct me on that.
I said "I said equally spaced values. Equally spaced means there is equal difference in each consecutive values of one component. For example, in 0, 128, 255, the 128 is closer to 0 due to gamma correction, and can be increased.".
Note it said one component. This allows it to be mixed with component reduction. Equal spaces in one component are independent of same in other component.
My question is "best palette", not "best palette with equally spaced values". I didn't mean to use exact general definition. Take gamma correction, and both equally spaced values and reduction into account.
« Last Edit: October 01, 2015, 03:18:26 pm by Piotr »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #28 on: October 01, 2015, 03:16:46 pm
.. So, what you're really trying to say is that you're not generating colorcubes, but something more complicated?
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #29 on: October 01, 2015, 03:20:21 pm
.. So, what you're really trying to say is that you're not generating colorcubes, but something more complicated?
Your question: Yes, but only if it's possible.
Talk: Read changes in my comments.

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #30 on: October 01, 2015, 03:24:54 pm
I think we've reached a point where no one has a clue what this thread is about?

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #31 on: October 01, 2015, 03:38:39 pm
I think we've reached a point where no one has a clue what this thread is about?
A good explanation:
I want a best 256 color palette, suitable for both programmers and artists. When someone suggests a method, use all suggestions together if possible, and you can use modifications to make it better. Read each method and modification carefully. Images I post without feedback are only samples, not intended to be candidates or good palettes, because I am not very good on making palettes alone.
Q: Why didn't you already do this before?
A: I didn't predict it will end up like this, for both methods (Ai) and attempt/sample images (Gil). Also I didn't know the terms "programmers" and "artists" before, but that's less important.
« Last Edit: October 01, 2015, 03:44:41 pm by Piotr »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #32 on: October 02, 2015, 12:28:30 am
Personally I believe that it isn't possible to generate a genuinely 'best' palette, for reasons I have stated before.

However I do believe that 'general purpose' palettes can be significantly better than the classic RGB 8:8:4 or 6:6:6 palettes. So I'm happy to provide some palettes in GPL and PNG format, which represent the closest I have gotten to a 256color palette that is generally acceptable.

(They were generated using Lch(ab) colorspace, by iterating over possible L values (0..100), checking which values of C and H are displayable sRGB colors, adding those colors to a list, and when done, artificially boosting contrast and applying 'k-means' algorithm to reduce these hundreds of thousands of colors to a set of 256. Variants were using different amounts of contrast boosting (and I also decided eventually to force the presence of a pure #ffffff white).)

If you're interested I can upload a zip file containing them.

EDIT: Link to zipfile. Contains GPL (GIMP/Inkscape/Mypaint/etc), PNG, and SOC(OpenOffice/LibreOffice) versions of each palette.

Also an Imgur gallery for quick preview
« Last Edit: October 02, 2015, 02:16:32 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #33 on: October 02, 2015, 05:33:43 pm
Personally I believe that it isn't possible to generate a genuinely 'best' palette, for reasons I have stated before.

However I do believe that 'general purpose' palettes can be significantly better than the classic RGB 8:8:4 or 6:6:6 palettes. So I'm happy to provide some palettes in GPL and PNG format, which represent the closest I have gotten to a 256color palette that is generally acceptable.

(They were generated using Lch(ab) colorspace, by iterating over possible L values (0..100), checking which values of C and H are displayable sRGB colors, adding those colors to a list, and when done, artificially boosting contrast and applying 'k-means' algorithm to reduce these hundreds of thousands of colors to a set of 256. Variants were using different amounts of contrast boosting (and I also decided eventually to force the presence of a pure #ffffff white).)

If you're interested I can upload a zip file containing them.

EDIT: Link to zipfile. Contains GPL (GIMP/Inkscape/Mypaint/etc), PNG, and SOC(OpenOffice/LibreOffice) versions of each palette.

Also an Imgur gallery for quick preview
First serious help! But please force both pure white and black and reduce potential of NES palette problem (lack of good saturated red/yellow/green/cyan/blue/magenta).
For 'general purpose' keep in mind text console palettes, black/white monochrome, games, etc.
But... Have you tried your palettes? Is the palette below good enough?
This is a subset of 16-16-16 level RGB where values are from 0 to 15.
Right 1 step: add 1 to every component
Right 4 steps: add 4 to blue
Down 1 step: add 4 to green
Down 4 steps: add 4 to red

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #34 on: October 02, 2015, 06:08:54 pm
I don't think you need so many pinks and purples. There's no good browns in there either. I think the cyan ramp should be fine and I can probably work with the green ramp. I seem to lack saturation in the oranges.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #35 on: October 02, 2015, 10:01:13 pm

EDIT: Link to zipfile. Contains GPL (GIMP/Inkscape/Mypaint/etc), PNG, and SOC(OpenOffice/LibreOffice) versions of each palette.

Also an Imgur gallery for quick preview
First serious help! But please force both pure white and black and reduce potential of NES palette problem (lack of good saturated red/yellow/green/cyan/blue/magenta).
That's actually a problem inherent to both K-means and median-cut reduction methods, which the added contrast was intended to counteract.
However, if you want exact black, you can just replace the darkest color with black, same as I did with white.

I didn't really care about -extremely- saturated colors when making these, though.
Quote
For 'general purpose' keep in mind text console palettes, black/white monochrome, games, etc.
But... Have you tried your palettes?
Of course I have tried my palettes, on a wide range of stuff from pixel art to photos. That's how I can say it's the best I've seen (reasonably accurate and reasonably legible, over a wide range of content)

Quote
Is the palette below good enough?
This is a subset of 16-16-16 level RGB where values are from 0 to 15.
No, it's not good enough then, since the whole 16-16-16 RGB cube (4096 colors) is not good enough.
All RGB colorcubes that aren't huge( 64x64x64) have the same problem -- too many saturated colors, lack of good pastels. Which are exactly the problems shown in your palette.

(this is putting aside the problem that 256 colors, no matter how 'optimally chosen', can never approach the quality of a palette chosen specifically for the work in question. An optimally chosen 4096-color palette is about the minimum size of palette I could believe was generally high quality enough to use on everything)

Surt posted a colorcube exploring tool http://img.uninhabitant.com/colourcube.html a while ago in the Off-Topic Thread, which includes the kind of options you are exploring here, and many others..

I don't think you need so many pinks and purples. There's no good browns in there either. I think the cyan ramp should be fine and I can probably work with the green ramp. I seem to lack saturation in the oranges.
)
If this is addressed at my palette (of which there are several variants), I agree completely. Those are pretty much the exact problems that I found. To me, we have these two approaches: colorcube generation, and reduction of colors from a set of 'representative' colors. If we could figure out how to combine the strengths of
both, the result would probably be more suitable.

IIRC you can specify weights as an input to k-means clustering, which I think would work to emphasize whatever subset you think is important.

I also made a hand-optimized palette for the OHRRPGCE's new default, in 2008. The users abuse it just as badly as the old default ;). But anyway here it is:




Each 'row' is 15 colors, which means I needed to add 14 duplicate colors to the end to make it fit in the image; that's why it's 15x18 in size.

I don't expect Piotr would think this one is relevant to his project, since it really doesn't care about completely saturated colors at all (in fact, it minimizes them in order to maximize points where ramps can cross over.)
« Last Edit: October 02, 2015, 10:26:15 pm by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: What is best 256 color palette?

Reply #36 on: October 02, 2015, 10:58:47 pm
What I would like to know is what is the end goal here? Are you planning to make some kinda custom "retro" console using an FPGA or something, or make a virtual console like PICO8?

If not this is all pretty pointless imo. As I stated before, if you only have 256 colours it is better to change them according to specific needs of your game/project.

Then again, this is all very esoteric with todays graphics hardware, and this is coming from someone who really enjoys restrictions.
There are no ugly colours, only ugly combinations of colours.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #37 on: October 03, 2015, 06:01:22 am
What I would like to know is what is the end goal here? Are you planning to make some kinda custom "retro" console using an FPGA or something, or make a virtual console like PICO8?

If not this is all pretty pointless imo. As I stated before, if you only have 256 colours it is better to change them according to specific needs of your game/project.

Then again, this is all very esoteric with todays graphics hardware, and this is coming from someone who really enjoys restrictions.
But your suggestion takes a lot of time!

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #38 on: October 03, 2015, 06:36:37 am
Which suggestion? Ptoing suggested "change the palette according to your project". If that takes a lot of time, then I think you need either a better palette editor or better asset management. Personally, GPick would be the tool of choice for me, to make a full 256 color palette.

There also used to exist a number of tools that will look at all your graphics and generate a good palette for them, but nowadays I think you usually can just use a sprite packer to pack all your assets into a single image, then indexize that to arrive at a good global palette. However, as Ptoing alludes to, the 256color limit really isn't that relevant any more anyway -- not needed for display, and the amount of disk space it saves is insignificant in modern terms.

Overall, I think it would be best if you would give an answer to Ptoing's question 'what is the end goal here?'. It's difficult to effectively help without knowing why you want an optimal 256 color palette.

EDIT: on the general topic of general 256color palettes, this looks interesting, and almost certainly better than the standard 6 6 6 or 8 8 4 colorcube palettes. My tests confirm it.

EDIT2: Here's a relatively-nicely-sorted version of it I made with the help of GPIck:

You can see the layout the author made on the webpage.
« Last Edit: October 03, 2015, 09:45:13 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: What is best 256 color palette?

Reply #39 on: October 03, 2015, 09:57:02 am
Making a good palette is something you need to learn with practise. If you can not make a good palette for something specific from scratch, you wont be able to make a "best" palette. And again, "best" makes no sense in this case anyway.

But you have not answered my question as to why you want to do this yet.
There are no ugly colours, only ugly combinations of colours.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #40 on: October 03, 2015, 07:24:58 pm
Expanded NES palette + programmer stuff (you can click images to zoom)

Offline Gil

  • 0100
  • ***
  • Posts: 1543
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #41 on: October 04, 2015, 02:19:36 am
You should really respond to replies in your thread, what's the point of opening one otherwise? You complained that no one was trying to help, yet when I gave my opinion on your palette, you ignored it. Now Ptoing asks you a question, kindly asks again to reply and you just ignore him completely. So again, I wonder what you want to get out of this thread? It's very difficult for us to help you if you make it all so vague?

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #42 on: October 04, 2015, 06:25:17 am
You should really respond to replies in your thread, what's the point of opening one otherwise? You complained that no one was trying to help, yet when I gave my opinion on your palette, you ignored it. Now Ptoing asks you a question, kindly asks again to reply and you just ignore him completely. So again, I wonder what you want to get out of this thread? It's very difficult for us to help you if you make it all so vague?
Because I'm a kid, I keep forgetting such things. It was not my palette, but someone shared idea into web. I didn't ignore opinion, but I just considered it on mind. I was just thinking reply was not required. There is still my new palette without review.

Making a good palette is something you need to learn with practise. If you can not make a good palette for something specific from scratch, you wont be able to make a "best" palette. And again, "best" makes no sense in this case anyway.
What if I can borrow NES palette and extend it? I know it won't be best, but it will be very good. Or do you think it would be best?

But you have not answered my question as to why you want to do this yet.
Sorry, but too few information. I need a quote showing what I want to do.

EDIT: on the general topic of general 256color palettes, this looks interesting, and almost certainly better than the standard 6 6 6 or 8 8 4 colorcube palettes. My tests confirm it.
Thanks, I might consider it. This page reminded me of using 9-bit RGB and limiting 8 LSB combinations to 4 of them. In "Hardware Palette" section, red LSB was made by xoring green and blue LSBs:
00=000 (slighty dark or black)
01=101 (slighty magenta)
10=110 (slighty yellow)
11=011 (slighty cyan)

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #43 on: October 04, 2015, 08:09:00 am
Making a good palette is something you need to learn with practise. If you can not make a good palette for something specific from scratch, you wont be able to make a "best" palette. And again, "best" makes no sense in this case anyway.
What if I can borrow NES palette and extend it? I know it won't be best, but it will be very good. Or do you think it would be best?

You still need to define 'best', since what palette is 'best' is a matter of application and personal taste.

For me, when I am considering generic palettes such as the one I linked above, I think in terms of minimizing visual error.

That is, my criteria is to take a large variety of images, quantize them to one palette and then to another; Compare those three sets (original, palette A, palette B); and the version which looks most like the original image, is the one I consider as 'better'.

Even in this example, it's apparent that simply 'best' is not a real thing; it is a process of finding two palettes, comparing their performance, and deciding that one achieves better performance than the other, for that specific usage.

Maybe this is a language-based misunderstanding, and the word you want is actually something different from 'best'?

Quote
Sorry, but too few information. I need a quote showing what I want to do.
What? He is asking YOU to explain what it is that you intend to do. You are asking about 'best palettes'. What is your purpose in asking that question?

To be clear: you can't simply 'have a best palette' that you use for everything. You can have a palette that you like and use for everything, but it cannot actually be 'best' for every use. All of the palettes we have considered so far will perform quite poorly when applied to a smooth airbrushed greyscale image, for example; but if you attempt to make them better at greyscale , then you will certainly make them worse for other uses.

Since that is the case, there is no possibility -- none -- for us to post any palette that is even 'good', never mind 'best'. Until you explain how you intend to use the palette.

If your intent is simply 'have a best 256color palette, and use it for everything' -- I'm afraid that is completely impossible. No such thing exists, and our current knowledge of human vision suggests that no one, no matter how clever, can ever invent one.

If your intent is more modest -- for example, you have a few particular projects you want to find a 'best' palette for.. That kind of thing is possible.
If that is your intent, please say so clearly.

Please excuse me for repeating myself, I just feel that I need to explain this idea in several different ways so that one of them will be communicated accurately to you.

Quote
EDIT: on the general topic of general 256color palettes, this looks interesting, and almost certainly better than the standard 6 6 6 or 8 8 4 colorcube palettes. My tests confirm it.
Thanks, I might consider it. This page reminded me of using 9-bit RGB and limiting 8 LSB combinations to 4 of them. In "Hardware Palette" section, red LSB was made by xoring green and blue LSBs:
00=000 (slighty dark or black)
01=101 (slighty magenta)
10=110 (slighty yellow)
11=011 (slighty cyan)
Yes, it's quite a clever solution.
However, it is not made by xoring green and blue LSBs, but red and blue LSBs. That's what the page says, at least.
« Last Edit: October 04, 2015, 08:40:37 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #44 on: October 04, 2015, 09:18:01 am
You still need to define 'best', since what palette is 'best' is a matter of application and personal taste.
You already know what is the meaning of single word "best". If you mean something different, use better wording, depending on what you mean:
"You still need to define 'best palette'."
"You still need to help define 'best' for some 4-year old kid with ideas."
Quote
EDIT: on the general topic of general 256color palettes, this looks interesting, and almost certainly better than the standard 6 6 6 or 8 8 4 colorcube palettes. My tests confirm it.
Thanks, I might consider it. This page reminded me of using 9-bit RGB and limiting 8 LSB combinations to 4 of them. In "Hardware Palette" section, red LSB was made by xoring green and blue LSBs:
00=000 (slighty dark or black)
01=101 (slighty magenta)
10=110 (slighty yellow)
11=011 (slighty cyan)
Yes, it's quite a clever solution.
However, it is not made by xoring green and blue LSBs, but red and blue LSBs. That's what the page says, at least.
Read closely:
Red_Bit_0 = Bit_2 XOR Bit_5
Red_Bit_1 = Bit_0
Red_Bit_2 = Bit_1
Green_Bit_0 = Bit_2
Green_Bit_1 = Bit_3
Green_Bit_2 = Bit_4
Blue_Bit_0 = Bit_5
Blue_Bit_1 = Bit_6
Blue_Bit_2 = Bit_7
It says Bit_2 XOR Bit_5. Bit_2 is green, while bit_5 is blue. But whether it's made by xoring one pair or another, it's same colors.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #45 on: October 04, 2015, 10:50:52 am
Since that is the case, there is no possibility -- none -- for us to post any palette that is even 'good', never mind 'best'. Until you explain how you intend to use the palette.
I wish there was a web site where you can make and share palettes from 2 to 256/65536 colors (including a possibility to use png images containing all the colors in palette), uncompressed image formats (modes) to fit in some graphics memory size (for example 320x200 16 colors fits in 32KB), an adapter containing multiple of them and possibility to make images fitting these modes. Then the purpose of "best palette" is making images/game screenshots for this site. Then this thread could serve as place in which users could choose one of these suggestions.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #46 on: October 04, 2015, 12:29:34 pm
You still need to define 'best', since what palette is 'best' is a matter of application and personal taste.
You already know what is the meaning of single word "best". If you mean something different, use better wording, depending on what you mean:
"You still need to define 'best palette'."
"You still need to help define 'best' for some 4-year old kid with ideas."
'best palette' is what is implied by that sentence, yes.


[/quote]
Read closely:
Red_Bit_0 = Bit_2 XOR Bit_5
Red_Bit_1 = Bit_0
Red_Bit_2 = Bit_1
Green_Bit_0 = Bit_2
Green_Bit_1 = Bit_3
Green_Bit_2 = Bit_4
Blue_Bit_0 = Bit_5
Blue_Bit_1 = Bit_6
Blue_Bit_2 = Bit_7
It says Bit_2 XOR Bit_5. Bit_2 is green, while bit_5 is blue. But whether it's made by xoring one pair or another, it's same colors.
[/quote]
Oh, yes, sorry, I didn't notice that bit_2 was referenced twice.

Quote
I wish there was a web site where you can make and share palettes from 2 to 256/65536 colors (including a possibility to use png images containing all the colors in palette), uncompressed image formats (modes) to fit in some graphics memory size (for example 320x200 16 colors fits in 32KB), an adapter containing multiple of them and possibility to make images fitting these modes. Then the purpose of "best palette" is making images/game screenshots for this site. Then this thread could serve as place in which users could choose one of these suggestions.
Okay.  This is good, this is more definite.

In that case, it seems to me that you indeed are not really looking for a 'best' palette, but rather, want a collection of different 'good' ones. For example, Arne's 16color and 32color palettes seem like they would fit into your idea here, and so does the EGA 64color palette and even the CPC 27color palette. Correct me if I'm wrong about any of those.

A second point I wanted to raise is: I'm aware that support for palettes larger than 256colors is much rarer than palettes <=256colors. Have you looked into what software can perform the necessary adaptation?

I also wanted to ask if you have tried GrafX2's RGB restriction option?  It seems relevant to your broad goal of exploring these restricted palettes.
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #47 on: October 04, 2015, 01:57:44 pm
Quote
I wish there was a web site where you can make and share palettes from 2 to 256/65536 colors (including a possibility to use png images containing all the colors in palette), uncompressed image formats (modes) to fit in some graphics memory size (for example 320x200 16 colors fits in 32KB), an adapter containing multiple of them and possibility to make images fitting these modes. Then the purpose of "best palette" is making images/game screenshots for this site. Then this thread could serve as place in which users could choose one of these suggestions.
Okay.  This is good, this is more definite.

In that case, it seems to me that you indeed are not really looking for a 'best' palette, but rather, want a collection of different 'good' ones. For example, Arne's 16color and 32color palettes seem like they would fit into your idea here, and so does the EGA 64color palette and even the CPC 27color palette. Correct me if I'm wrong about any of those.

A second point I wanted to raise is: I'm aware that support for palettes larger than 256colors is much rarer than palettes <=256colors. Have you looked into what software can perform the necessary adaptation?

I also wanted to ask if you have tried GrafX2's RGB restriction option?  It seems relevant to your broad goal of exploring these restricted palettes.
It's recommended that palette size is a power of two. E.g. if palette uses 10 colors, it either can be increased to 16 colors or requires inefficient modulo operations. The CPC palette can be increased to 32 colors, while filling in gaps (e.g. brown, two more grays, one desaturated color and ramp fill color).

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #48 on: October 05, 2015, 12:12:31 am
... Do you even have a complete working system for this website, yet? Or, at least, profiling data for some working quantization code?

If you did, making it faster might be relevant.
« Last Edit: October 05, 2015, 12:30:14 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #49 on: October 05, 2015, 08:27:54 am
... Do you even have a complete working system for this website, yet? Or, at least, profiling data for some working quantization code?

If you did, making it faster might be relevant.
I didn't say this website exists, just that I wish that it existed.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #50 on: October 05, 2015, 12:06:16 pm
Then concerns like "it's recommended that palette size is a power of two." are completely irrelevant.

If you would like to expand CPC palette out to 32 colors, why not? You seem to like that idea.

But there is no compelling performance reason to do so. Most existing quantization routines* support any size of palette, not just powers of two; and, because of this, using palette sizes that are powers of two does not improve the speed at all. This is because the code was not written using that optimization.

* for example, the ones in ImageMagick, GIMP, and GMIC.

If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: What is best 256 color palette?

Reply #51 on: October 05, 2015, 12:17:54 pm
Fairly sure you will like this little thing member Surt has made
http://img.uninhabitant.com/colourcube.html
There are no ugly colours, only ugly combinations of colours.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #52 on: October 05, 2015, 01:12:54 pm
That reminds me of an idea I had after seeing that 'Palette256' link:


Sort of combining the ideas of that Palette256 and the EGA64 palette, this is a 4-5-3 color'box' (not cube since it hasn't got equal plane lengths) plus 4 grey shades, totalling 64 colors.

It seems to have better flesh tones than EGA64 (which isn't saying too much, admittedly) and a slightly reduced incidence of 'colors that seem very similar when you put them side by side'; and of course it has better green resolution and more greys.

'Palette256' also reminded me that there are other geometrical shapes to base a palette on than just box-shaped or cube-shaped volumes. A cone, or two cones back to back, is one option (suitable for colorspaces where one axis is polar, like HCY, HSL, or LCH). The main difficulty with these is, it's harder to predict their total size.
« Last Edit: October 05, 2015, 01:26:16 pm by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #53 on: October 06, 2015, 06:18:42 am
Then concerns like "it's recommended that palette size is a power of two." are completely irrelevant.

If you would like to expand CPC palette out to 32 colors, why not? You seem to like that idea.

But there is no compelling performance reason to do so. Most existing quantization routines* support any size of palette, not just powers of two; and, because of this, using palette sizes that are powers of two does not improve the speed at all. This is because the code was not written using that optimization.

* for example, the ones in ImageMagick, GIMP, and GMIC.
I am going to keep all 24-bit color in arts, and not quantizing them. These concerns become relevant if you think of older machines like CGA or ZX Spectrum, not the newer ones like VGA or Windows.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #54 on: October 06, 2015, 09:07:32 am
Then concerns like "it's recommended that palette size is a power of two." are completely irrelevant.

If you would like to expand CPC palette out to 32 colors, why not? You seem to like that idea.

But there is no compelling performance reason to do so. Most existing quantization routines* support any size of palette, not just powers of two; and, because of this, using palette sizes that are powers of two does not improve the speed at all. This is because the code was not written using that optimization.

* for example, the ones in ImageMagick, GIMP, and GMIC.
I am going to keep all 24-bit color in arts, and not quantizing them. These concerns become relevant if you think of older machines like CGA or ZX Spectrum, not the newer ones like VGA or Windows.
.. Do you mean that you want to write quantization code that runs natively on retro platforms like Spectrum, using 24bit images as input? That seems strange and probably not what you meant, but I can't think of any other way to understand what you mean.

(BTW, CGA, VGA and Windows are not machines.  PC is a machine. CGA and VGA (and EGA) were video cards for PC. Windows is a family of operating system that runs on PCs)
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #55 on: October 06, 2015, 10:30:06 am
Then concerns like "it's recommended that palette size is a power of two." are completely irrelevant.

If you would like to expand CPC palette out to 32 colors, why not? You seem to like that idea.

But there is no compelling performance reason to do so. Most existing quantization routines* support any size of palette, not just powers of two; and, because of this, using palette sizes that are powers of two does not improve the speed at all. This is because the code was not written using that optimization.

* for example, the ones in ImageMagick, GIMP, and GMIC.
I am going to keep all 24-bit color in arts, and not quantizing them. These concerns become relevant if you think of older machines like CGA or ZX Spectrum, not the newer ones like VGA or Windows.
.. Do you mean that you want to write quantization code that runs natively on retro platforms like Spectrum, using 24bit images as input? That seems strange and probably not what you meant, but I can't think of any other way to understand what you mean.

(BTW, CGA, VGA and Windows are not machines.  PC is a machine. CGA and VGA (and EGA) were video cards for PC. Windows is a family of operating system that runs on PCs)
I am not going to write code at all, just a possibility to make images and save it in format compatible with ZX Spectrum, CGA and others. Quantization is only made when saving in this format. Now palettes of power of two make sense because of the format it's saved!

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #56 on: October 06, 2015, 11:03:21 am
Okay, that clarifies things a little.

I have to ask though, how do you expect to use these palettes on ZX Spectrum, etc, given that most of the colors in them are not available on that display hardware?
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #57 on: October 06, 2015, 06:22:08 pm
Okay, that clarifies things a little.

I have to ask though, how do you expect to use these palettes on ZX Spectrum, etc, given that most of the colors in them are not available on that display hardware?
The images are quantized only to colors possible to display.

Offline spaceman00

  • 0001
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #58 on: January 15, 2016, 04:47:54 pm
Corel Photopaint has a effect that can reduce the amount of colors of a image, actually 2 of them one called opmized and another called adjusted.

This is the pallete you get when you use adjusted effect on a image that has a single pixel to all colors, ordered by luminance, and reduce it to 256 colors


To compare this is the adjusted with 16 colors


And this is 2 colors adjusted one



The 256 colors optimized one is


The 16 optimized one is (YES I also think this is a strange as fuck pallete, considered how it was made)


The 2 colors optimized one.
« Last Edit: January 15, 2016, 04:51:35 pm by spaceman00 »

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #59 on: February 27, 2016, 08:05:23 am
I would consider using these palettes:
4 colors:
Black Red Cyan Yellow
Black Red Green Yellow
16 colors: ZX Spectrum palette with values 0, 170, 255. In other words, RGB combinations using 0, 255 or 0, 170.
256 colors:

This one is a subset of 9-bit RGB palette of 8 values for each, with LSBs of components merged like this:
Code: [Select]
8bit 9bit (rgb)
00   000
01   011
10   100
11   110
with the only exception being brightest color, which is white. Available pure colors are black, red, cyan, yellow and white. There are 5 true grays.

Subset of 12-bit RGB palette where 2 LSBs of components are merged. 16 grays available.
65536 colors:
A palette with 4 bits of red, green, blue and alpha (16 grays).
Another one:

4 LSBs of components are merged from 24-bit RGB. 256 grays.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #60 on: January 08, 2017, 03:53:33 pm

EDIT: Link to zipfile. Contains GPL (GIMP/Inkscape/Mypaint/etc), PNG, and SOC(OpenOffice/LibreOffice) versions of each palette.

Also an Imgur gallery for quick preview
First serious help! But please force both pure white and black and reduce potential of NES palette problem (lack of good saturated red/yellow/green/cyan/blue/magenta).
That's actually a problem inherent to both K-means and median-cut reduction methods, which the added contrast was intended to counteract.
However, if you want exact black, you can just replace the darkest color with black, same as I did with white.

I didn't really care about -extremely- saturated colors when making these, though.
NES palette contained extremely saturated colors, but it didn't contain the right hues for red/yellow/green/cyan/blue/magenta. This is the problem I was talking about. You don't care about extremely saturated colors, but I care: Include all 8 basic colors to cover the corners of RGB cube.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #61 on: January 08, 2017, 04:43:19 pm
Okay, that clarifies things a little.

I have to ask though, how do you expect to use these palettes on ZX Spectrum, etc, given that most of the colors in them are not available on that display hardware?
The images are quantized only to colors possible to display.
Also the saving format in any picture is binary. So there is no clear way of storing 10-color picture while taking less space than 16-color one. You need things like storing 3 pixels in 10 bits. Here are the sizes of raw pictures the size of 320*200 with various palette storage systems (excluding size and indexed color info, KB is 1000 B, KiB is 1024 B):
2 color:
8 KB, 7.8125 KiB
3 color (5 pixels in 8 bits):
12.8 KB, 12.5 KiB
4 color:
16 KB, 15.625 KiB
5 color (3 pixels in 7 bits):
18.66725 KB, 18.229736328125 KiB (64000 pixels are not divisible by 3, so it's a bit more than 18.66666... KB)
6 color (5 pixels in 13 bits):
20.8 KB, 20.3125 KiB
8 color:
24 KB, 23.4375 KiB
However for older machines/video cards like ZX Spectrum, GameBoy or CGA, tricks like storing 5 pixels in a byte for 3 colors are either slow (using mod operations) or consume system memory (if you define what each byte means, for example 7F byte may be defined as black, yellow, yellow, cyan, black). That's why it's better to use powers of 2 for number of colors in storage. Go to newer machines/video cards and you'll find out that you have 16777216 colors already. 320x200, 640x200 (with tall 1x2 pixels that can resemble 640x400 by using stretched 8x8 fonts in place of 8x16), 640x400, 1280x800, ... are the resolutions that provide maximum size with binary video memory sizes and palettes with 2^(2^n) colors (2, 4, 16, 256, 65536, 4294967296, ...) while 320x256, 640x256, 640x512, 1280x1024, ... merit palettes with 2^(3*(2^n)) colors instead (8, 64, 4096, 16777216, ...). 640x480 and 1024x768 don't have this property.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #62 on: January 10, 2017, 05:14:22 pm
If I interpret your question correctly, you want to know which 256 colors to pick to a palette to make things look good. This is called the black magic art of color reduction. There's plenty of ways to perform it, some work better than others, and all of them are wrong, as what you're doing is removing information. One common way is to place all desired colors into an octree and then reading out the 256 biggest cells; another is to do median-cut of the color space until you have 256 segments.
But how can I get an image to reduce colors? Making art with no palette or color restrictions is harder than making art and picking the colors of art from the best 256 color palette or 16 or 4 or 2.

On topic: I'm pretty sure this is best palette:

Organized version:

Though the ramps in the first one look like 10 colors, they can be combined with 6 color ramps in websafes to create 16. A ramp from none to full of n values actually has fractions of n-1, so the full 16-color ramps (0/15 to 15/15) contain 6-color websafe ramps (0/5 to 5/5) and so does the full 4096 color palette (16x16x16) I decided to base this palette on instead of 512 (8x8x8) color palette.
« Last Edit: January 11, 2017, 07:10:55 am by Piotr »

Offline yrizoud

  • 0010
  • *
  • Posts: 330
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #63 on: January 12, 2017, 02:01:26 pm
I don't think you'll convince anyone. This palette is ultra-saturated, how can you pick colors for skin tones or hair when drawing a character's portrait, what about natural shades to draw scenery : ground, trees, foliage, stone, sky,...?
I really think you should look at any of the threads from other people who design palettes, they explain their choices and get feedback from others. This will help you understand what people consider useful in a palette :
Arne 16 : http://pixelation.org/index.php?topic=4306.0
DawnBringer's DB16 : http://pixeljoint.com/forum/forum_posts.asp?TID=12795
DawnBringer's DB32 : http://pixeljoint.com/forum/forum_posts.asp?TID=12795
Lendrick's 32 color "Bright Fantasy" : http://pixeljoint.com/forum/forum_posts.asp?TID=18845

Edit : Here is an extrapolation of DB16 and Arne16 to 256 colors, by simply adding 2 new colors between all pairs of colors in the original (the resulting 240 colors are then sorted by hue).

___
If you try to reduce any arbitrary image to any of those palettes, it's very likely that the result preserves many different shades, while the websafe palette would provide very few useful colors.

(Lua script to expand a 16-color palette in Grafx2) :
Code: [Select]
target=16
for y = 0, 15, 1 do
  for x = y+1, 15, 1 do
    r1, g1, b1 = getcolor(y)
    r2, g2, b2 = getcolor(x)
   
    setcolor(target, (r1 * 2 + r2)/3, (g1 * 2 + g2)/3, (b1 * 2 + b2)/3)
    target = target+1
    setcolor(target, (r1 + r2 * 2)/3, (g1 + g2 * 2)/3, (b1 + b2 * 2)/3)
    target = target+1
  end
end

 
« Last Edit: January 12, 2017, 04:04:11 pm by yrizoud »

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #64 on: January 13, 2017, 01:23:10 am
I would rather say that Piotr is trying to solve a problem that is so abstracted it doesn't exactly exist. Arriving at a good palette (or ellipse) is beside the point and so advice about what is useful is irrelevant -- the real problem is the idea that these problems can be resolved in an "ideal" way (rather than experimentally felt out for a given image/context)
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #65 on: January 14, 2017, 07:49:10 am
I would rather say that Piotr is trying to solve a problem that is so abstracted it doesn't exactly exist. Arriving at a good palette (or ellipse) is beside the point and so advice about what is useful is irrelevant -- the real problem is the idea that these problems can be resolved in an "ideal" way (rather than experimentally felt out for a given image/context)
I repeated this a lot of times. I DON'T want good ellipses. Paint.net gives them. I want to see which ellipses different people prefer.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: What is best 256 color palette?

Reply #66 on: January 14, 2017, 12:28:18 pm
My mistake. In that case, I have to ask, what do you aim to learn from these topics? They are both contextual questions -- a good palette and a good ellipse exist only in relation to an effect you hope to achieve.

A person does not, IME, set out to make 'a 3x5 ellipse', but rather, sees that an ellipse may be suitable here, throws an arbitrary ellipse down, and adjusts it until it suits the context. Factors such as how bright the ellipse should be, what level of contrast it should have with the background, whether it needs to be animated, and whether it is part of a tile all enter into exactly what shape is used, as well as more difficult to pin down concerns as it's contribution to the overall likeness of the subject / conformity to the particular style of the game, site, or project it is supposed to be a part of.
Similar considerations apply to palettes, and, I think it is reasonable to say, 99% of all art-related work. Examining WIP animations can demonstrate this process.

What I am trying to say is that, when you insist that the context, which is the only thing that makes a given choice meaningful, is excluded from replies, there is, AFAICS, nothing at all that anybody can say about the topic (if abiding by the terms you specify).
« Last Edit: January 14, 2017, 12:47:28 pm by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #67 on: January 14, 2017, 06:44:36 pm
I don't think you'll convince anyone. This palette is ultra-saturated, how can you pick colors for skin tones or hair when drawing a character's portrait, what about natural shades to draw scenery : ground, trees, foliage, stone, sky,...?
Doing art is very restricting way to test palettes. A best palette has to be universal for: art, text console, emulating, UI, ... . With 8 simple colors, , you can have any color by dithering, and using websafes can make the colors for dithering closer to wanted color, and it's better for fine shading tasks like anti-aliasing. It would be pretty stupid to have a palette without , since I need them to have a best palette. My 256 color palette is a subset of 4096 color but in a different way that allows exactly and includes websafe palette. The remaining 40 colors make ramps for anti-aliasing. Just because you noticed problems for art doesn't mean it's a bad palette. A best palette has to be universal for: art, text console, emulating, UI, ... . So the websafe palette does the job for all tasks, and 40 color ramp fill fixes the weak point in grayscale and text. Also it's easy to pick colors. Pick the color from non-restricted color selector (you can pick from 4096 colors too), then convert to websafe. That's it. While extrapolated Arne and stuff would be horrible if you want these extra saturated colors. My palette does the perfect job if you want these saturated colors. Repeated:
256 colors image:

Organized to show 16-color ramps:

Try to show perfect yellow text on black background. In my palette, it's easy: use FFFF00 as text (last in yellow ramp) and use 000000 as background (first color)

Offline yrizoud

  • 0010
  • *
  • Posts: 330
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #68 on: January 26, 2017, 12:30:39 pm
(edit: in reply to the deleted post "Bump this thread")
What about we bury it instead. It's been nearly 17 months and you're still ignoring or rejecting other people's answers.
« Last Edit: January 27, 2017, 01:45:34 pm by yrizoud »

Offline Piotr

  • 0001
  • *
  • Posts: 71
  • Karma: +0/-1
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #69 on: January 27, 2017, 09:04:45 am
What about we bury it instead. It's been nearly 17 months and you're still ignoring or rejecting other people's answers.
That's because they are bad.

Offline Jehannum

  • 0001
  • *
  • Posts: 22
  • Karma: +0/-0
  • MMA-inspired Artist
    • jehannumma
    • View Profile

Re: What is best 256 color palette?

Reply #70 on: February 19, 2017, 08:58:39 pm
I finished a large pixel project (1200x1100px) months ago but then I found this site and decided to redesign it to be suitable for posting here. It's a gif, so at the end I converted it to 256 colours which led to various issues, though none insurmountable. This time I intend to reduce the hues for most of the background content as well as fixing the many issues with shading, while leaving the stronger hues of the characters intact.

do you guys think I should try and create a palette ahead of time, or work through every section and then figure it out at the end? I know how to generate a palette from an image and I have a tool for quickly generating all the swatches for that palette in my software. I use Corel PaintShop Pro x3 (not photoshop)

I will be posting a thread soon for my project but this palette issue has been bugging me all week.
-----Working on my sig-----