Skip to main content
bala281972
Known Participant
March 4, 2013
Answered

Color samplers - dark, light & grey point - how to adjust curves

  • March 4, 2013
  • 2 replies
  • 13159 views

Hi all

I've set dark, light & grey point in an image. Wondering how to adjust the curves based on the color samplers. Manually i invoke the curve dialog box and select the dark pen and choose sampler no1, select light pen and choose sampler no2, select grey pen and choose sampler no3. Any idea how this can be done in script?

This topic has been closed for replies.
Correct answer Michael_L_Hale

URL is http://we.tl/YDaioOa9gE


OK, I see one of the problems and you noticed it yourself, you just may not have understood what is happening.  When using the eyedroppers in the curves panel it doesn't matter if you use the black or white eyedropper first. You can set the white point then the black point or reverse that order and you still get the same curve. What does matter is when you use the grey eyedropper. That has to be used after both the white and black point has been set. If you set grey in the middle it gets discarded when you set the last point and you get the same curve if you just skipped the grey point altogether. In other words if you don't set the grey point last you in effect didn't set it at all.

Notice in your video that when you click on the sampler on the neck that the image is very cyan. It's only when you click on the last sampler that the color returns to something more normal. You can see the same thing looking at just the curves. Clicking on the neck creates curves with long arcs. Clicking on the last sampler turns it into lines between the white and black point( because the grey point is discarded )

Which brings us back to where the sampler are placed make a big difference. Skin tone is not where you would want to set the grey point. I think you are using the luminance mask to tone down the adjustment because the black and white points are also poorly placed. The color at the black point is in the 20s. I think a better place would be under the jaw to the right of the neck. In fact that area is already 0,0,0 so I wouldn't set a black point. The white sampler is in the 230s. Setting that to white clips a lot of the wall in the upper left.

2 replies

c.pfaffenbichler
Community Expert
Community Expert
March 6, 2013

To illustrate what I have been writing about I created an image that is only 161/120/85 and once used the Script that set those values to 127 and once set the gray point manually.

Inspiring
March 6, 2013

Christoph, when you say 'set the gray point manually' do you mean using the input/output boxes? Or do you mean using the mid-tone eyedropper? I would expect the eyedropper to give a different result depending on the settings in the curve panel options and the brightness/luminosity of the color sampled. I think if the sampled color is not near mid-tone grey then there can be a difference between the resulting image with these two methods. The farther away from min-tone grey the bigger the difference. I think with enough effort it would be possible to come up with some forumla that gets the input/output values closer to the values used by the eyedropper.

I think a bigger problem is not so much how to change that color but do we really want to. In other words but we really think that sampler is at an area that should be a netural gray? It looks to me like that sampler is in the corner of an eye. Somewhere I would expect the color to be on the red/pink side of netural. I would think that the 'whites' of the eye or the teeth would be a better place set to netural.

I don't think that levels would be useful. You could set the black/white points with a levels adjustment layer. But as you can do that with curves as well as set the mid-tones I would just use curvres and have only one adjustment layer.

c.pfaffenbichler
Community Expert
Community Expert
March 7, 2013

Or do you mean using the mid-tone eyedropper?

Yes, I mean the »Sample in image to set gray point« eyedropper from the Curves dialog.

And the calculation that is performed on the picked pixel’s values (with default options) has eluded me so far.

c.pfaffenbichler
Community Expert
Community Expert
March 4, 2013

This creates a Curves Layer via two equally long Arrays for each RGB Channel for the In- and Output values.

#target photoshop

var theArray = [[0, 128, 255], [0, 150, 255], [0, 128, 255], [0, 90, 255], [0, 75, 230, 255], [0, 30, 180, 255]];

rgbCurvesLayer (theArray);

////// make rgb curves layer //////

function rgbCurvesLayer (theArray) {

// =======================================================

var idMk = charIDToTypeID( "Mk  " );

    var desc5 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref2 = new ActionReference();

        var idAdjL = charIDToTypeID( "AdjL" );

        ref2.putClass( idAdjL );

    desc5.putReference( idnull, ref2 );

    var idUsng = charIDToTypeID( "Usng" );

        var desc6 = new ActionDescriptor();

        var idType = charIDToTypeID( "Type" );

            var desc7 = new ActionDescriptor();

            var idpresetKind = stringIDToTypeID( "presetKind" );

            var idpresetKindType = stringIDToTypeID( "presetKindType" );

            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );

            desc7.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );

        var idCrvs = charIDToTypeID( "Crvs" );

        desc6.putObject( idType, idCrvs, desc7 );

    var idAdjL = charIDToTypeID( "AdjL" );

    desc5.putObject( idUsng, idAdjL, desc6 );

executeAction( idMk, desc5, DialogModes.NO );

// =======================================================

var idsetd = charIDToTypeID( "setd" );

    var desc8 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref3 = new ActionReference();

        var idAdjL = charIDToTypeID( "AdjL" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref3.putEnumerated( idAdjL, idOrdn, idTrgt );

    desc8.putReference( idnull, ref3 );

    var idT = charIDToTypeID( "T   " );

        var desc9 = new ActionDescriptor();

        var idpresetKind = stringIDToTypeID( "presetKind" );

        var idpresetKindType = stringIDToTypeID( "presetKindType" );

        var idpresetKindCustom = stringIDToTypeID( "presetKindCustom" );

        desc9.putEnumerated( idpresetKind, idpresetKindType, idpresetKindCustom );

        var idAdjs = charIDToTypeID( "Adjs" );

            var list1 = new ActionList();

                var desc10 = new ActionDescriptor();

                var idChnl = charIDToTypeID( "Chnl" );

                    var ref4 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idRd = charIDToTypeID( "Rd  " );

                    ref4.putEnumerated( idChnl, idChnl, idRd );

                desc10.putReference( idChnl, ref4 );

                var idCrv = charIDToTypeID( "Crv " );

                    var list2 = new ActionList();

// add r points;

for (var m = 0; m < theArray[0].length; m++) {

          addCurvePoint (list2, theArray[0], theArray[1])

          };

                desc10.putList( idCrv, list2 );

            var idCrvA = charIDToTypeID( "CrvA" );

            list1.putObject( idCrvA, desc10 );

                var desc15 = new ActionDescriptor();

                var idChnl = charIDToTypeID( "Chnl" );

                    var ref5 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idGrn = charIDToTypeID( "Grn " );

                    ref5.putEnumerated( idChnl, idChnl, idGrn );

                desc15.putReference( idChnl, ref5 );

                var idCrv = charIDToTypeID( "Crv " );

                    var list3 = new ActionList();

// add g points;

for (var m = 0; m < theArray[2].length; m++) {

          addCurvePoint (list3, theArray[2], theArray[3])

          };

                desc15.putList( idCrv, list3 );

            var idCrvA = charIDToTypeID( "CrvA" );

            list1.putObject( idCrvA, desc15 );

                var desc20 = new ActionDescriptor();

                var idChnl = charIDToTypeID( "Chnl" );

                    var ref6 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idBl = charIDToTypeID( "Bl  " );

                    ref6.putEnumerated( idChnl, idChnl, idBl );

                desc20.putReference( idChnl, ref6 );

                var idCrv = charIDToTypeID( "Crv " );

                    var list4 = new ActionList();

// add b points;

for (var m = 0; m < theArray[4].length; m++) {

          addCurvePoint (list4, theArray[4], theArray[5])

          };

                desc20.putList( idCrv, list4 );

            var idCrvA = charIDToTypeID( "CrvA" );

            list1.putObject( idCrvA, desc20 );

        desc9.putList( idAdjs, list1 );

    var idCrvs = charIDToTypeID( "Crvs" );

    desc8.putObject( idT, idCrvs, desc9 );

executeAction( idsetd, desc8, DialogModes.NO );

//

return app.activeDocument.activeLayer;

////// add curve point //////

function addCurvePoint (theList, valueHor, valueVer) {

var desc11 = new ActionDescriptor();

var idHrzn = charIDToTypeID( "Hrzn" );

desc11.putDouble( idHrzn, valueHor );

var idVrtc = charIDToTypeID( "Vrtc" );

desc11.putDouble( idVrtc, valueVer );

var idPnt = charIDToTypeID( "Pnt " );

theList.putObject( idPnt, desc11 );

};

};

bala281972
Known Participant
March 4, 2013

Hi

Im sorry. I guess I have not explained properly. I have set 3 color samplers in the image. One is the lightest portion and one darkest position and the last one being mid tone. Now I would like to apply thest pointa using set white dark mid tone pens available in the curve tool. How to set this using script.

c.pfaffenbichler
Community Expert
Community Expert
March 4, 2013

As you have the RGB values of the three points feed them into above function with the corresponding target values you want.

Could you please post an example where you have already set the color samplers?