What number is red?

    Mar 03 2014 | 12:00 pm
    I'm trying to design a patch where the colour swatch position assigns a number. I've attached the patch, and would love some help with it please.

    • Mar 04 2014 | 9:12 am
      bump :)
    • Mar 04 2014 | 9:46 am
      have a look at jit.colorspace, after doing the conversion from rgb to hls, you'll need to unpack and then scale the h value to the range you want
    • Mar 04 2014 | 2:35 pm
      could I get an example please? Finding it complex to get head 'round.
    • Mar 04 2014 | 10:56 pm
      examples are in the relevant help files: jit.colorspace unpack scale
    • Mar 05 2014 | 9:27 am
      Thanks for pointing me to the helpfiles. Though. having trouble adapting them to my patch idea.. its a little beyond my grasp. Any examples or tweaks of my original patch would be really appreciated.
    • Mar 06 2014 | 8:54 am
      The number of red? That depends on the flavor of Thursday and the time of corduroy. But if you're just looking for the broad stroke, red primary is the first value of RGB of which the purest expression is 255 0 0, normalized as 1 0 0. But if you want just a number, then it would be 16,711,680 or 111111110000000000000000 binary. Unless you stick with hue, in which case it's 0.
      Here is the simplest way I know to get your patching going...
    • Mar 06 2014 | 9:18 am
      If you have to use the actual output of swatch, you can convert RGB to hue and scale it to your index range. But the standard color conversion objects in max kinda suck (with the glorious exception of rgb2hsl and hsl2rgb in jit.pix). Here's an rgb to hue patch that uses standard max objects and outputs accurate values.
    • Mar 10 2014 | 12:46 pm
      Cool thanks for the examples metamix- Really useful!