Skip to main content
Pipedreamer
Participant
May 25, 2018
Question

Limit output to a range of 32,768 colors?

  • May 25, 2018
  • 6 replies
  • 2225 views

I'm not quite sure how to explain this properly, but I'll try my best - feel free to ask follow-up questions!
For the sake of retro 2D art, I'm trying to convert various full-color resources into a particular color space.
Effectively, there are only 32 possible values each for Red, Green, and Blue.
Those values are as follows:
0, 8, 16, 24, 32, 40, 48, 56,
64, 72, 80, 88, 96, 104, 112, 120,
128, 136, 144, 152, 160, 168, 176, 184,
192, 200, 208, 216, 224, 232, 240, and 248.


You can also look at it as ranging from 0-31, multiplied by 8.

In hex, you could represent any one value as xy, where x is a value from 0-f, and y is only ever 0 or 8.

Hopefully one of those explanations made sense, and we can move on to what I'm trying to do.
Also, if there is a standardized name for this, I would love to know!

My goal is to take an image, and convert every RGB value in the image to fit within the above-described color space, via rounding.
So for example, if I have a pixel in a shade of purple using the values 57, 21, 82, it should round those values up or down to 56, 24, 80.

Does anyone know if there is a setting or filter in Photoshop, or perhaps an external tool to achieve this?

This topic has been closed for replies.

6 replies

rayek.elfin
Legend
May 25, 2018

Btw, your math is off to begin with: 0-8 is 9 values, not 8. Which is why 248 is the last value divisible by 8. You should start counting 0-7, 8-15, etc.

Gernot is correct in saying that the 8 units you want is pure arbitrary, and has no basis in real "retro" hardware colour palettes.

Talk:List of color palettes - Wikipedia

rayek.elfin
Legend
May 25, 2018

Use the proper tool for the job, and Photoshop fails miserably in this case (which is to be expected, because, as Mylenium already stated: Photoshop doesn't do custom indexed palettes).

Instead, use Pro Motion NG, which is specialized in creating (retro) pixel graphics, and allows the user to set up custom color channels with adjustable number of bits from 2 up to 8 for each individual R, G, B, and A channel. It comes with a range of presets (including a gameboy colour 32,768 preset), and all sorts of other "rules" may be used (non-square pixels, specific colour constraints such as number of colours used in total, or per tile).

Copying and pasting a graphic will remap the colours to an existing palette, or adjust it for you by taking the limitations of a R5,G5,B5 32,768 colours into account, and remap to the closest possible values (just like you need).

Pro Motion NG sort-of is the "Photoshop" equivalent for pixel artists. If you need strict colour palette control, that is your answer: get Pro Motion NG. https://www.cosmigo.com/

Inspiring
May 25, 2018

You may use Posterize with 32 levels per channel. The result contains level 0 and level 255 as well,

not exactly what you want. Chr.Pfaffenbichler's tweaking might help. But in my opinion it's not reasonable

to exclude the highest level.

Here we have the full range but a slightly irregular sequence:

0 8 16 24 33 41 49 57 66  ... 247 255

Best regards

--Gernot Hoffmann

Mylenium
Legend
May 25, 2018

PS does not support arbitrary bit depths and that is that. It's not directly possible in PS. You will have to use an image conversion tool and pick out a 12 bit or whatever format to handle the color quantisation. That is unless you have an elaborate set of color profiles that would mimic reduced color spaces. Otherwise you can always try indexed color modes or building your own quantisation stuff with elaborate channel operations and filters applied per channel.

Mylenium

c.pfaffenbichler
Community Expert
Community Expert
May 25, 2018

My goal is to take an image, and convert every RGB value in the image to fit within the above-described color space, via rounding.

While it seemed fairly clear what you wanted to achieve I think you don’t use the term »Color Space« correctly.

Color space - Wikipedia

Pipedreamer
Participant
May 25, 2018

Ah, yes, sorry - I'm not any kind of professional - I know what I want, just not what it's called. lol

I guess it would be something more like a limited set of possible colors, like back in the old days of Windows 95 in 256 color mode.
To my knowledge, it's not so much just that "there can only be 256 colors on-screen", but rather "there are 256 possible colors that can be displayed, and they are these ones in particular".
I feel like what I'm looking for is a high color version of that.
Surely there must be some way to round color values.
The solution you proposed looks like it might be doing what I'm looking for, but I don't fully understand what you did to achieve it.
I've never used Posterize or Curves adjustments before.
Can you explain what you've done in the custom settings, so I can more closely follow along?

Inspiring
May 25, 2018

If you just want to represent the colors reasonably by 32 levels per channel, then use

Posterize (as already explained in #4) or save as BMP X1-R5-G5-B5 and reload into

Photoshop for further handling. No need for other software.

The difference between this high color version and your suggestion is mainly, that you

cannot represent pure white.

X1 is a single dummy bit, because available file formats require 16 bit per color (in this case).

The quantization is done by 5 bit per channel, equivalent to 32 levels.

Best regards --Gernot Hoffmann

c.pfaffenbichler
Community Expert
Community Expert
May 25, 2018

Posterize at 33 and a Curves Adjustment Layer to adjust the 7 to 8 etc. and cap the top should work out.