Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Limit output to a range of 32,768 colors?

Community Beginner ,
May 24, 2018 May 24, 2018

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?

1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 25, 2018 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.

32ValuesPerChannelScr.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 25, 2018 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 25, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 25, 2018 May 25, 2018

I tried the Posterize and X1 R5 G5 B5 BMP, but I'm still getting numbers like 206, 173, and 148, none of which are divisible by 8, which is kind of my whole thing.
I know it probably seems arbitrary, but ultimately, I only want values equal to 8*x.
I'm not sure how I ended up leaving out value 256 (or value 32), I guess I was thinking 0-31 = 32 options.
Anyway, when it all comes down to it, I want every value of every channel of every pixel to be divisible by 8.

I'm pretty sure this was commonly used in retro gaming consoles.

Sadly, the suggestion of Pro Motion made by @rayek.elfin doesn't seem to have helped as much as I had hoped, as I couldn't find the option to limit the colors according to that standard, nor could I find any clear answers in the documentation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 25, 2018 May 25, 2018

Pipedreamer,

please don't insist on your idea of levels with 8 units distance. This is merely a

mathematical construct without practical relevance.

Opposed to this, the mentioned conversions map the input range x [0 to 255 step 1]

to an output range y [0,255] with k steps, e.g. k=32. The step size cannot be exactly

the same, e.g. 8,  for the range [0,255] but it could be for [0,256].

The compromise is already contained in the practical solutions.

Best regards --Gernot Hoffmann

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 25, 2018 May 25, 2018

In Pro Motion NG, File-->new Project-->Create, set the RGBA-channels to 5-5-5-2. You'll be working with a max 32,768 colour palette. Since Pro Motion works in indexed 8bit mode only, importing an image will be limited to 256 colours only.

Then copy the image in Photoshop (select and copy), and in PM choose Edit-->Get Brush. In the popup dialog, select Nearest Color, and max. 256 colours. Use an optimized palette. Click OK, and stamp the image down in your file. The result is an image mapped to a 256 colours from a palette of 32,768. Older (console) hardware worked the same: on a typical (very) old Windows 95 PC we had 256 colour max onscreen @ 800x600, from a 32,768 or higher palette (VESA S-VGA cards 5:5:5 HiColor modes).

So that means you will have a palette of 32,768 colours to choose from, but max 256 colours to work with at one time in the same image.

PM will map those to correct values within the 5x5x5 channel limitations. However, values will not be exactly mapped to 8-divisible values.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 25, 2018 May 25, 2018

Image-->Adjustments-->Posterize. Or use an adjustment layer "posterize"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 25, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 25, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 25, 2018 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/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 25, 2018 May 25, 2018
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines