Average selection HSB + setting HSB

Bit of a an unusual one for you here; but here it is anyway... Is it possible to get the average TSL value of a randomly selected area without applying the average filter, using script?  The selection is already created before the script is executed, so all the script needs to do is to get the average value of the selected area HSB.  In addition, it is possible to set then selected values STL of the region to a predetermined?  I want to keep the detail, but say, darken an area if it is brighter than the preset or Desaturate it if the color is too strong.  Any ideas on how to make these / if it is possible to do these?  I'm sure the other is feasible but not so sure about the first one, so any help is appreciated.

dgolberg

I tend to use paths so that they cannot be ideally mounted on stuff, but in this case, I suppose to create a work path is a valid option to determine a point of the area of a layer.

This Script will likely include a control to check the preferences are defined on morw than 6 States in history, but most of the users who probably have anyway.

You can try this?

// get hue, saturation and brightness from an averaged layer;
// 2011; use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
if (app.activeDocument.activeLayer.kind == LayerKind.NORMAL) {
var myDocument = app.activeDocument;
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var historyState = myDocument.activeHistoryState;
try {
// apply average filter;
myDocument.activeLayer.applyAverage();
hideOthers ();
// load layer transparency;
// =======================================================
var idsetd = charIDToTypeID( "setd" );
    var desc4 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idfsel = charIDToTypeID( "fsel" );
        ref2.putProperty( idChnl, idfsel );
    desc4.putReference( idnull, ref2 );
    var idT = charIDToTypeID( "T   " );
        var ref3 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idTrsp = charIDToTypeID( "Trsp" );
        ref3.putEnumerated( idChnl, idChnl, idTrsp );
    desc4.putReference( idT, ref3 );
executeAction( idsetd, desc4, DialogModes.NO );
// contract selection and make path;
myDocument.selection.contract(50);
myDocument.selection.makeWorkPath(1);
// get one point;
var thePoint = myDocument.pathItems[myDocument.pathItems.length - 1].subPathItems[0].pathPoints[0].anchor;
// set colorsampler;
var myColorSampler = myDocument.colorSamplers.add(thePoint);
// return and set foreground-color;
var theH = myColorSampler.color.hsb.hue;
var theS = myColorSampler.color.hsb.saturation;
var theB = myColorSampler.color.hsb.brightness;
// undo path and colorsampler;
myDocument.activeHistoryState = historyState;// myDocument.historyStates[myDocument.historyStates.length - 2];
alert ("hue "+theH+"\nsaturation "+theS+"\nbrightness "+theB)
}
catch (e) {alert ("failed")};
// reset;
app.rulerUnits = originalRulerUnits;
}
};
////// toggle visibility of others //////
function hideOthers () {
// =======================================================
var idShw = charIDToTypeID( "Shw " );
    var desc10 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var list4 = new ActionList();
            var ref7 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref7.putEnumerated( idLyr, idOrdn, idTrgt );
        list4.putReference( ref7 );
    desc10.putList( idnull, list4 );
    var idTglO = charIDToTypeID( "TglO" );
    desc10.putBoolean( idTglO, true );
executeAction( idShw, desc10, DialogModes.NO );
};

Tags: Photoshop

Similar Questions

  • I saw in the previous discussion, that InDesign in CC2015 police problem has been resolved by setting to "search the entire font name" but I can't find any place to select this setting. Pleae advise!

    I saw in the previous discussion, that InDesign in CC2015 police problem has been resolved by setting to "search the entire font name" but I can't find any place to select this setting. Pleae advise!

    Look at the top of this thread:

    Cannot access fonts with InDesign CC 2015

  • When you save a file to the [.jpg] format, I wonder to choose a quality from 1 to 100. What are the changes in the created file based on the selected quality setting?

    When you save a file to the [.jpg] format, I wonder to choose a quality from 1 to 100. What are the changes in the created file based on the selected quality setting? I would like to know what changes, so in the future, I can set my camera to one who will give me the highest quality in a first time, which allows me to make cultures and always preserve the quality.

    Thank you

    Dovid

    Thank you twenty-one... your answer of common sense to me.

    so, in short, can I assume down the chosen quality over compression algorithm?

  • What is the average of default setting in the subject area Permission screen in SPR

    Hello gurus,

    We use OBIEE 11.1.1.7.150120. Trying to figure out how to play the permissions on the domain object.

    What is the average of the 'default' setting?  It translates to 'Read-write' or 'Read' or 'access forbidden '?  or business being a top-level object, the parameter 'Default' basically inherits the permission set for the application role "AuthenticatedUser"?

    Thank you

    Rakesh

    Hello

    Here is a copy/paste of the 'help' in the administration tool:

    By default. The permission is inherited from the parent object. Areas, because they are a higher level object, default value is equivalent to the permission granted to the application role AuthenticatedUser.

    If you ask for materials, 'default' in this case means same permission as an authenticated user.

  • Selection of setting inside the component af:table LOV

    Hi all

    I use Jdev 12 c.

    I can't find anything on the definition of the selection of a component of SelectOneChoice when it is inside a table.

    My use case: I'm iteration in a list of serial numbers, and ask a CreateWithParams liaison to a number of different parameters.  Those new lines appear in an af:table component.  One of these parameters can take the values 1, 2 or empty.  For this attribute, I have set up a selectOneChoice with a fixed/static LOV to the choice.  Now, the CreateWithParams is correctly set the value of the ViewObject line, but I don't know how to set the selection SelectOneChoice the correct value.  It is not done automatically.  Y at - it a way I can get the RichSelectOneChoice component in my managed java bean for each line so that I can manually set the selection of the component?

    Thanks for reading.

    Lance

    Solved the problem with a static list display object.  It was with my link layer.  The LOV was not part of the binding of the tree, so he was not updated correctly.  For those who have this problem in the future, put in place a static list view object and access it like a LOV in the view object related to af: table.

  • The selected condition setting

    I have created a report in the plu discoverer that has a setting called plantype, values inside are postpaid, prepaid, hybrid.
    I need to create 3 conditions as below
    When: plantype = hybrid and select all the data where plantype in ('hybrid', 'postage paid')
    When: plantype prepaid = and select all the data where plantype in ('hybrid', 'postage paid')
    When: plantype postpaid = and select only data "post-paid".
    Please let me know how we can achieve this discoverer 10g more

    Thanks in advance...
    Laurianne.

    Hello

    You can create conditions composed as:

    IN plantype_item (: plantype)
    OR (plantype_item IN ('hybrid', "paid") AND: plantype IN ("hybrid", "paid"))

    Rod West

  • the user's selection by setting the security filter in the ASO to unsort database

    We found a very annoying feature of Essbase: when we make the security filter setting in the ASO database through the console of Regional service, we found that the selection of the user list is not sorted. It is very very difficult to identify the appropriate user name to set the security filter.

    All the tips and tricks can improve the process?

    I don't think that this problem is related to ASO - filters are filters.

    All you need to do to sort the column filters is to change the filters, then click on the column heading "name of the filter. It sorts fine in the EE 9.3.1.

    Kind regards

    Cameron Lackpour

  • Find the average of a set of times

    Hi all

    I have a spreadsheet with 52 pages (weeks of the year, sort of a planner) and every day I type in my wake-up time. Until the end of the week there are 7 times, then a column that has successfully made the average at that time. (see below) using this formula: AVERAGEIF(A3:G3,">5:59",A3:G3)

    I intentionally do include only periods after 05:59 in the formula.

    As you can see it does that very well. All the averages for each week are then sent to an "annual" table on another page (see below)

    The problem when coming to this second table, each average weeks appears in the average annual table always shows the last time which was received (in this case, 09:22). In other words, it does not indicate the average. The formula I use for this table is: AVERAGEIF(C2:BC2,">5:59",C2:BC2)

    So what on earth am I doing wrong?

    Thank you :-)

    I can't read anything in the second table you have posted... it's too small.

    Perhaps to show how the weekly averages go weekly table at the annual table.

  • Loop through the sequences selected using set of entry points into LabVIEW OI

    Hi all

    I have an operator Interface where the operator has the option to select specific measures and loop over the sequence selected according to the needs.

    Everything works as expected, but the customer wants to remove the default loop configuration pop-up box.

    Must be defined by programming the parameters of the loop (and not by the user). I figured out how to build arguments interactive but don't know how to spend it.

    Any ideas / suggestions would be greatly appreciated.

    Thanks in advance.

    Kind regards

    SS

    UnspecifiedError wrote:

    I am aware of this method and it works well, but the requirement is to run with the model process for example 'Test DUT' entry point

    Use SequenceViewMgr.ExecutionEntryPoints to get the corresponding entry point object, and then use EntryPoint.LoopOnSelectedSteps ().

    Hope this helps,

    -Doug

  • How to change the color of selected text-setting to default value

    Hello
    I'm WORD 2007 documents on a LCD Dell monitor display. Selected-text-point color highlight default appears as a light blue barely visible.

    I would like to change this color to something more visible, especially when I do a SEARCH/REPLACE, maybe even a bright yellow.

    Can someone tell me the ability to change the select text color by default?

    Thanks in advance,
    David

    Ah, I think I understand now.

    Try that and see if it's what you want

    Right-click on properties/Desktop

    On the appearance tab click the Advanced button

    To the title of the item change the color of the "selected items".

    .

  • Select the set of facts to compare as a guest of dashboard

    Hello

    We have a requirement like this, and I don't know if this is possible in OBIEE.

    We have 11 facts:

    YTD actual
    Expected for a YEAR
    One year of the previous year
    CDA - 2 prerequisite
    Forecasts for the full year
    Overall plan of the year
    Full year last year
    Round 2 years before
    Round 3 years before
    Round 4 years before
    Round 5 years before

    On a dashboard, we have 5 (for each organization) bar charts comparing the facts (for example real CDA, planned for a YEAR, full year forecast)...
    However, a user wants to select any 3 of the above facts and he wants these 3 facts to account for all the 5 bar graphs in the dashboard.

    Something like a selector column but based on facts (no dimensions) and as a guest of dashboard controls, rather than a report.

    Any ideas on how to achieve this?

    Thank you very much
    Ash.

    Hey Ash.,.
    I think that it is possible to create something like that, but in a different way.
    I would create a report, with a view of column selector and a pivot table view.
    In your column Chooser, you add three columns with all measures.
    Then, you change the pivot table display.
    The area of sections, you must add the organization.
    Then you need only display the PivotTable list.
    The result is a ranking by the organization.
    In the composed layout, you can put the display of column selection and the entire pivot table view selector.

    Kind regards
    Stijn

  • To help Dreamweaver CC 2014.1.1, when I select a set of paragraphs to turn into a list of definitions and select Format - lists - definition lists, I get the tags < dl > but do not get the < TD > or < dd > tags?

    I've used before in earlier versions of DW and it worked fin.  I tried tonight with CC 2014.1.1 or view creation or in codeview with the same results.  I choose the < p > tag text start at the tag < /p > final and then in the menu choose Format - List - list of definitions and get only the < dl > tags.  All this experience?

    Thank you!

    This is how it works in CS6, too.  And it's not just for definition lists.  This is the result expected any list type that you use.   DW knows not where the DTs and DDs begin and end because you have highlighted an entire paragraph and asked DW format as a distribution list.

    I code my own definition of lists in general.  It is faster.

    Nancy O.

  • Average use of memory in MB? Not %

    I have the following code that uses get-stat to gather cluster statistics and exports the timestamp and the memory usage average percentage in the csv format:

    # In-memory cluster statistics

    foreach ($cluster in $xml. Settings.Setting.Clusters.Cluster)

    {

    $metrics = "mem.usage.average".

    $stats = get-stat-entity (get-cluster $cluster) - Stat $metrics - start $start - finishing $finish - interval 86400

    $groups = $stats | Group-object - property {$_.} TimeStamp, $_. @entity.name} $report = $groups | % {

    New-object PSObject-property @ {}

    'TimeStamp' = $_. Group [0]. TimeStamp

    '%' = $_. Group | where {$_.} MetricId - eq "mem.usage.average"} | Select value - ExpandProperty

    }

    }

    $csv_clustermem = ($ScriptPath + $cluster) + '_mem.csv '.

    $report | Select the TimeStamp, '% '. Export-Csv $csv_clustermem - NoTypeInformation

    Mem_Chart # launch Excel and generate the graph

    I do not know how to retrieve the memory in MB with her average? I tried to simply add Mo as an additional property to retrieve and then expand but I don't think that's true.

    Thanks in advance

    Try something like this

    $finish = Get-Date$start = ($finish).AddDays(-7)$metrics = "mem.usage.average"$cluster = Get-Cluster
    
    $stats = get-stat -Entity $cluster -Stat $metrics -Start $start -Finish $finish -Interval 86400$groups = $stats | Group-Object -Property {$_.TimeStamp, $_.Entity.Name} $report = $groups | % {  $totMem = $_.Group[0].Entity.ExtensionData.Summary.TotalMemory  $memAvgPerc = $_.Group | where {$_.MetricId -eq "mem.usage.average"} | Select -ExpandProperty Value  New-Object PSObject -Property @{    Cluster = $_.Group[0].Entity.Name    TimeStamp = $_.Group[0].TimeStamp    '%' = $memAvgPerc    'Avg MB' = [math]::Round(($totMem * $memAvgPerc / 1MB / 100),0)  }}$report
    
  • How do I browse the selected links?

    Hello!

    I'm looking for clues on how to run a script on selected links (selected in the window).

    As this example script that runs an alert when the links are missing:

    aDoc var = app.activeDocument;

    for (var n = 0; n < aDoc.links.length; n ++) {}

    var aLink = aDoc.links [n];

    If (aLink.status == LinkStatus.linkMissing) {}

    Alert (ALink.FilePath);

    }

    }

    Is there something like LinkStatus.linkSelected?

    Or some other way for the script to sort the selected links.

    Any input would be much appreciated!

    Thank you!

    / Peter

    Hello

    As far as I know - not possible to read the link selection (any Panel UI).

    Another solution?

    -to create a dialog of the listBox (each list item is a link read a doc) and the 'multiselect' property defined as 'true '.

    The average user can select a set of links, and the script can do a work based on the selection.

    Jarek

  • Please HELP: forms PDF, creating an average formula for text?

    Hello

    I really hope that somone can help. I can't find all the answers to my questions on the internet, google etc.

    First time using Acrobat. IM quick enough for learning about compters however formulas that my boss has asked me to do I don't know if they are possible.

    We have a report form, for exams, and each section that I need to calculate the average score for this section.

    There are 3 issues in the first section. There are drop down menus for distinction, merit and pass below collar to select for each question.

    Please see attached picture to show you what I mean.

    I want to be able to calculate the most selected/average selected dropdowns and don't count the award1 terrainpour na?

    The fields must be text and can not be numbers.

    Thus, for example, track 1 won an award, track 2 obtained a merit, track 3 got a distiction. all other fields left n/a

    Screen Shot 2013-10-10 at 12.15.12.png

    is there anyway to do this, so it is possible to exactly the same as above as checkboxes? s ' please see attached picture

    Screen Shot 2013-10-10 at 12.17.59.png

    I appriciate any help. I'm working on a mac

    Thank you

    Lauren

    Let's say that the box fields are called 'CheckBox 1' to "box 12". You must set their export value (under Properties - Options) to the value that they reprenset, and then you can use this script to calculate the average:

    var total = 0;

    var n = 0;

    for (var i = 1; i)<=12; i++)="">

    var v = this.getField("CheckBox"_+i).value;

    If (v! = 'Off') {}

    n ++ ;

    Total += Number (v);

    }

    }

    If (n == 0) {}

    Event.Value = "";
    } else event.value = total/n;

Maybe you are looking for