Forums > Jitter

increase luminance of a matrix

Sep 26 2013 | 9:53 am

I’m trying to create a jitter effect (using jit.op or some other object through which I can pass an existing matrix) where each pixel has its luminance increased, as if the H portion of the HSL notation had been increased.

So for example, if luminance runs from 0.0 to 1.0, and we fed in a parameter of 0.3, then the luminance value of each pixel increases by 0.3. Thus, pure red would become pink, muddy yellow would become a brighter yellow, etc. Luminance would be capped at 0.1, so any pixel that was already close to full luminance would just look white.

I’ve attached a screenshot to make my intentions clear.

I tried jit.brcosa (using the @brightness attribute), but this does not raise a pixel above it’s original luminance – it can only reduce it.

I have a hunch that I will need to convert each pixel value to HSL, increase the L portion, then convert back to RGB. I have the required formulas from – but I’m not sure how I would use them in Max. Is this a job for Gen perhaps?

  1. Screen-shot-2013-09-26-at-17.27.50


Sep 26 2013 | 10:33 am

jit.rgb2hsl and it’s @lscale attribute

Sep 26 2013 | 10:55 am

So simple! Thanks!

Sep 26 2013 | 11:14 am

Here’s a demo. I used jit.rgb2hsl as advised, and then jit.hsl2rgb to convert it back.

-- Pasted Max Patch, click to expand. --


Sep 26 2013 | 5:36 pm

unfortunately 2hsl and 2hsv are the only ones which i did not got right from looking at the quasi codes found on the web, when i tried to do them all recently.

the picture below shows how it would look like (if the last bug in it would be corrected finally – i somehow lost interest in it)

btw, not sure how important it is for your project, but the L in HSL stands for lightness, and not for luminance. ;)

for luminance, which you were asking for, you would need ALL of the three abstractions i posted in this thread

quite a bunch of code for something so simple.


  1. hsl-forum


Sep 26 2013 | 6:01 pm

no, wait, thats luma, not luminance, my bad.

it is always a bit hard to keep the difference between lightness, brightness, luminance, and luma in mind if you´re not native english. ;)

luminance or lightness can be found in L*a*b.


Viewing 6 posts - 1 through 6 (of 6 total)

Forums > Jitter