在JavaScript中,我可以使用如下函数调整图片的色彩平衡:
colorBalanceLayer(-50,0,0)
function colourBalanceLayer(cya, mag, yel)
{
// cyan, magenta, yellow values are between -100 & +100
var id713 = charIDToTypeID( "ClrB" );
var desc162 = new ActionDescriptor();
var id714 = charIDToTypeID( "ShdL" );
var list37 = new ActionList();
list37.putInteger( 0 );
list37.putInteger( 0 );
list37.putInteger( 0 );
desc162.putList( id714, list37 );
var id715 = charIDToTypeID( "MdtL" );
var list38 = new ActionList();
list38.putInteger( cya );
list38.putInteger( mag );
list38.putInteger( yel );
desc162.putList( id715, list38 );
var id716 = charIDToTypeID( "HghL" );
var list39 = new ActionList();
list39.putInteger( 0 );
list39.putInteger( 0 );
list39.putInteger( 0 );
desc162.putList( id716, list39 );
var id717 = charIDToTypeID( "PrsL" );
desc162.putBoolean( id717, true );
executeAction( id713, desc162, DialogModes.NO );
}
这个方法很好用,例如我在我的例子中为图片的中间色调添加了大量青色。我想知道的是:如果我想通过类似于上面例子中-50青色的数值来修改RGB颜色,该如何操作?最好将颜色改成CMKY,适当地进行调整,然后再改回RGB吗?只是我听说最好先从RGB转到L*ab(我知道如何做)。
red += 50
,则应该有green -=25
和blue -= 25
。 - Martin Ernst