HSB resolution Question

Using HSB colour mode, does anyone know the correct resolution / setting for each without any internal calculations??
Example: colorMode(HSB, 45,97,43) would cause a conversion when reading / writing values respective to actual correct HSB settings in colorMode.

I’m expecting:
H= 0 > 255
S= 0 > 255
B= 0 > 255

As this would make sense in RGB mode ??
But Hue ranges from 0>359. Can we display all 360 hues or is this internally altered to 0 > 255 ??

I’m not sure to understand your question but the second and further arguments of the colorMode() function is the range of the values you input in color.

So if you write colorMode(HSB, 360, 100, 100), the hue will be a value from 0 to 360 and Saturation and Brightness from 0 to 100.

Here is the reference: colorMode() \ Language (API) \ Processing 3+

1 Like

To understand HSB (Hue, Saturation, Brightness), it’s best to play with a colour mixer, like the one in GIMP:

The Hue values lie along the ring that surrounds the triangle – hence, they range from 0 to 360 degrees. The Saturation (S) and Brightness (V) values range between 0 and 100 percent.

Typically, you’d use this code for red:

colorMode(HSB, 360, 100, 100);
background(360, 100, 100);

The colorMode() defines the ranges for each H/S/B parameter. For a red background, the Hue value points to East, and the Saturation and Brightness are set to 100%.

For the colour ‘opposite’ to red (the pale blue), it’s background(180, 100, 100)

1 Like

Hello,

Some references on Processing website:

On Medium:

Examples on Processing website and in Processing PDE:

image

The Processing PDE has a Color Selector in the Tools menu:

image

:)

Thanks all for your info.
I fully understand HSV and RGB externally (conversions etc)

Am just interested in how colours are stored in PGraphics.

On initial question using HSV,
H= 0 > 359
S= 0 > 100
B= 0 > 100

Gives 3.6 million combinations

RGB
R= 0 > 255
G= 0 > 255
B= 0 > 255

Gives 16.6 million combinations

What is the highest setting for HSB which uses all combinations in the PGraphics array (24 bit etc).
(As setting H to 3600 will results in loss in array)
RGB usually has a 0 > 255 range, and setting higher to 2550,2550,2550 would waste definition due to PGraphics limit.

What is this limit

I’ve seen a post here mentioning internal reading / write HSB conversions resulting in jumps in increment / decrement.

So using RGB now as easier to control.
Far better results.

Here are some low-res images using original HSB settings. Currently rendering with new RGB.

Thanks again!!

Irigima.

1 Like

You had me thinking about this!

I did this and put it in the gallery:

:)

1 Like

It’s internally calculated as float so the range shouldn’t matter

Such an amazing amount of technical input from you all.
Thank you.

I am actually reverting back to RGB now (0>255) as easier to function / control.

Holding a count per pixel externally reflecting PGraphics (but not limited as PGraphics), then applying a scale, resulting in
768 combinations per pixel.
N (scaled to 768)
R=N
G=N-256
B=N-512

(Black>Red>Yellow>White)

Works really well.

r/Irigima

1 Like