Algorithm for Hue/Saturation Adjustment Layer from Photoshop

后端 未结 6 764
春和景丽
春和景丽 2021-01-31 11:39

Does anyone know how adjustment layers work in Photoshop? I need to generate a result image having a source image and HSL values from Hue/Saturation adjustment layer. Conversion

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 12:16

    Photoshop, dunno. But the theory is usually: The RGB image is converted to HSL/HSV by the particular layer's internal methods; each pixel's HSL is then modified according to the specified parameters, and the so-obtained result is being provided back (for displaying) in RGB.

    PaintShopPro7 used to split up the H space (assuming a range of 0..360) in discrete increments of 30° (IIRC), so if you bumped only the "yellows", i.e. only pixels whose H component was valued 45-75 would be considered for manipulation.

    reds 345..15, oranges 15..45, yellows 45..75, yellowgreen 75..105, greens 105..135, etc.

    if (h >= 45 && h < 75)
            s += s * yellow_percent;
    

    There are alternative possibilities, such as applying a falloff filter, as in:

    /* For h=60, let m=1... and linearly fall off to h=75 m=0. */
    m = 1 - abs(h - 60) / 15;
    if (m < 0)
            m = 0;
    s += s * yellow_percent * d;
    

提交回复
热议问题