Feedback

Please leave feedback and comments. I am always interested to hear how people get on using these LScripts!

Friday, 10 June 2011

LScript - Image_Exposure


LScript (Layout) to simulates how over exposure on a photo bleeds to over expose areas of an image in to white.

Compatible with Newtek LightWave 9.6 and above.

// LScript Image Filter - www.StephenCulley.co.uk
//
// web   address: http://www.stephenculley.co.uk
// email address: email@stephenculley.co.uk

/*  
    LScript Image Filter - Exposure

    Image_Exposure.ls

*/

@version 2.5
@warnings
@script image
@name *Exposure

    // Title
    sTitle = "*Exposure";

    // Version
    sVersion = "v1.0";

    nAmount = 0.5;

create
{
    setdesc(sTitle + " : " + nAmount);
}

process: ifo
{
    iProgress = ifo.height;
    if(runningUnder() != SCREAMERNET) moninit(iProgress);
    for(i = 1;i <= ifo.height;++i)
      {
      for(j = 1;j <= ifo.width;++j)
        {
        nExposure = 0.0; 
        if(ifo.red[j,i] > nAmount) nExposure += (ifo.red[j,i] - nAmount);
        if(ifo.green[j,i] > nAmount) nExposure += (ifo.green[j,i] - nAmount);
        if(ifo.blue[j,i] > nAmount) nExposure += (ifo.blue[j,i] - nAmount);
        nExposure *= 0.333;                      
        ifo.red[j,i] = clip(0.0,1.0,ifo.red[j,i] + nExposure);
        ifo.green[j,i] = clip(0.0,1.0,ifo.green[j,i] + nExposure);
        ifo.blue[j,i] = clip(0.0,1.0,ifo.blue[j,i] + nExposure);
        }
      if(runningUnder() != SCREAMERNET) if(monstep()) return;
      }
}

// CLIP

clip: min,max,n
{
    if(n < min) n = min;
    if(n > max) n = max;
    return(n);
}

load: what,io
{
    if(what == SCENEMODE)
    {
        nAmount = io.read().asNum();
        setdesc(sTitle + " : " + nAmount);
    }
}

save: what,io
{
    if(what == SCENEMODE)
    {
        io.writeln(nAmount);
    }
}

options
{
    reqbegin(sTitle + " " + sVersion);

    // Control
    ctrl_c0 = ctlnumber("Amount",nAmount);

    // Developer
    ctlsep();
    ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk");

    return if !reqpost();

    nAmount = getvalue(ctrl_c0);
    setdesc(sTitle + " : " + nAmount);

    reqend();
}


All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs

No comments:

Post a Comment