Color Sampler script part 2

Ok. So I'm back at it. Here's what I have a problem to find now any help would be appreciated of course.

When I use the colorSamplers script I am able to get information on a single point. However, when you set the sampling points there is the possibility to select the single point, 3 by 3 average, 5 by 5 average 11 of 11, etc., and the average number is shown in the Info Panel. But, the script always returns the information of single point and not the average. Is it possible to obtain this information using another script that through every point with the colorSamplers [0] .move () and make the calculation in the script in order to get the average? This is how I do it now, but for large surfaces, it can become slow.

Any advice?

No, I don't mind at all. You can replace your scriptlistner turn off with the method DOM comes to make the code a little tighter.

activeDocument.selection.deselect ();

Tags: Photoshop

Similar Questions

  • How to add a color sample in a Photoshop script?

    Hello

    I would like to set a point of color sampler in a Photoshop script?

    Could you please help me on this.

    Thank you

    Rajiv.s

    var theSampler = app.activeDocument.colorSamplers.add([10,10]);

    Alert (theSampler.color.rgb.red + "_" + theSampler.color.rgb.green + "_" + theSampler.color.rgb.blue);

    Edit: And don't forget that a document can have only four ColorSamplers (from CS5 at least).

  • Color select Script needs refining

    Hello

    I've been running this simple script (created by an end PS scripter) in action:

    #target Photoshop

    main() {} function

    if(!documents.) Length) return;

    app.activeDocument.colorSamplers.removeAll ();

    var X = activeDocument.width.as('px')/2;

    var sample = activeDocument.colorSamplers.add ([new UnitValue (X, 'px'), new UnitValue (1, 'px')]);

    app.backgroundColor = sample.color;

    app.activeDocument.colorSamplers.removeAll ();

    }

    main();

    It selects the top center pixel color, sample, for the bottom point. Now I need to select a 5 x 5 moy. Second, is there a way to hide the INFORMATION pane, which opens by running the script? This appears not be called from an action, of course, and I'm not script.

    Thanks for any help.

    This should make an average...

    #target Photoshop
    function main(){
    if(!documents.length) return;
    var startRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    try{
    app.activeDocument.colorSamplers.removeAll();
    var X = activeDocument.width/2;
    var LB=[];
    LB[0] = X.value;
    LB[1] = 1;
    LB[2] = X.value +5;
    LB[3] = 6;
    var tmpColour = new SolidColor();
    var savedState = activeDocument.activeHistoryState;
    activeDocument.selection.select([[LB[0],LB[1]], [LB[2],LB[1]], [LB[2],LB[3]], [LB[0], LB[3]]], SelectionType.REPLACE, 0, false);
    activeDocument.activeLayer.applyAverage();
    var sample = activeDocument.colorSamplers.add( [ new UnitValue( X+1, 'px' ), new UnitValue( 2, 'px' ) ] );
    tmpColour=sample.color;
    activeDocument.activeHistoryState = savedState;
    app.backgroundColor=tmpColour;
    app.preferences.rulerUnits = startRulerUnits;
    }catch(e){alert(e + " - " + e.line);}
    }
    main();
    

    I was not able to stop the information panel so I add to my open panels is not intrusive.

  • The color sampler tool display adjustments?

    If I place a point on an image and then making adjustments 10 is there a way to look at how the color sample will change with each setting?

    Now I have to go back to the individual layer "bg" I'll call her to see the new color information once the adjustments have been made. I would like to see how the color of the adjustment layer info is done for all BY making the adjustments.

    There is indeed something odd current.

    This is not the behavior I get from my side.

    Capture instant 1 displays values before adjusting: 128-105 - 57

    Now, I add a layer of settings:

    Because I don't have not already change anything the two values are always the same:

    Now I change the curve:

    end the Info shows both the old and new values:

    Now, I click on the layer of the image:

    and the info panel displays only the new values:

    If I click on the adjustment layer:

    Then I see the before and after values:

    I have PS CC, but that I can remember nothing has changed in this regard.

    If this is not the behavior you see that I suggest you trash the file. Whenever Photoshop strange which is always the first remedy to try.

    Kind regards

    Ronald

  • Hsv values (instead of rgb) color sampler

    Hello!

    Is it possible to make the color sampler tool indicate the hsv values in the Panel info instead of rgb?

    Click on an icon of the sampler as converted (boxed) in red on the image below. This gives a menu of reading choices.

  • Brush is limited to 90 ° and as a color sampler tool

    I have a problem with my brush tool because its cursor appears as a color sampler icon and it is limited to 90 or 180 degrees paint (sometimes just 90). Everything was working normally with my last use a day or so there.

    Other facts:

    I downloaded the latest update

    Shift caps lock is not on.

    I am unable to right click in the options bar and reset all the tools

    I'd appreciate any help available. Thank you!

    http://forums.Adobe.com/thread/784569?TSTART=0

  • Chaning color Illustrator script?

    Hello community! I have about 600 files that I need to change the colors of pale green/dark green to light blue/dark blue, and I need a script for this. Here are a few simple letters divided in two and everything I need is the upper part to be dark blue instead of dark green and the lower part to be light blue instead of the original light green. Is this possible? I use windows 10 as my operating system. Any help is very appreciated!

    Kind regards

    David.

    This code should you select a folder and then loop through all files with. EPS file extensions.
    Note that this script assumes that all colors are exactly the same two Greens as in this sample file you sent.

    You will need to replace the RGB values of the above colors in the marking lines.<- here"="" with="" the="" values="" for="" the="" new="" blue="">

    function ConvertColors() {
    
        /* REPLACE THESE RGB VALUES */
        var topColor = new RGBColor();
    
        topColor.red = 0;    // <- HERE
        topColor.green = 0;    // <- HERE
        topColor.blue = 255;   // <-HERE
    
        var bottomColor = new RGBColor();
    
        bottomColor.red = 255;   // <- HERE
        bottomColor.green = 0;   // <- HERE
        bottomColor.blue = 0;  // <- HERE
    
        /* ~~~~~~~~~~~~~~~~~~~ */
    
        // we'll just use the Red value of the top to identify which color we have
        var oldTopColor = 140;
    
        var dir = Folder.selectDialog("Where?");
        var files = dir.getFiles("*.eps");
    
        // loop through all the files in the selected directory
        for(var f = 0; f < files.length; f++){
            var doc = app.open(files[f]);
    
            // loop through all paths and change the colors based on current fill
            var paths = doc.pathItems;
            for( var i = 0, ii = paths.length; i < ii; i++ ) {
                var curPath = paths[i];
    
                // check the fill color to see if it has the same Red value as the old top color
                if( curPath.fillColor.red == oldTopColor ) {
                    curPath.fillColor = topColor;
                }
                // if not it must be the bottom color
                else {
                    curPath.fillColor = bottomColor;
                }
            }
    
            // close and save the changes
            doc.close(SaveOptions.SAVECHANGES);
        }
    }
    
    ConvertColors();
    

    I hope this helps!

  • Color conversion script?

    I am looking for a way to print the CMYK, RGB, HEX easily, in the text, and possibly another representation of certain colors, I thought I'd write a quick script... easy, right? Apparently not.

    Although I have never used, it seems that Photoshop has the 'SolidColor' object, which has properties for 'cmyk', 'rgb', 'gray' etc... exactly what I need, except I want to do that in Illustrator. Illustrator has the "CMYKColor', 'RGBColor" etc. objects with, from what I can tell, no way to convert any other color mode.

    Then. am I missing something obvious? Or y at - it no way to easily get representations of different a color in artificial intelligence object color mode? I know that the conversion will be different according to the profiles of boards etc., but the UI color picker has the right values that already and, apparently, Photoshop can do it without problem so I'm hoping that I'm missing just something obvious!

    I tried to change the "TypeName" of the Color object, I've seen suggested, but it made no difference (the docs say it is read only).

    The only other options I can think is to create a new document in color mode I want to convert, to create a new color from the existing (which from reading the reference sounds like it will be auto-convertir it in this color mode) read the values of the new color and close the newly created document. But that seems to be a horrible workaround. Or, set up my own conversion function, which seems so horrible (since I thought it would be easy to write quick script!)

    Any input would be appreciated!

    Your code has been very useful Silly-V, convertSampleColor(), it was exactly what I was looking for! If you or anyone is interested, now is my script. Havn't tried a lot and it could probably be cleaned up a bit, but it should work (it does for me with CS6 on OS X).

    It takes all your selected samples and print the CMYK, RGB and HEX (and name if it is a spot color) all these samples selected in a txt file. The txt file is saved with the same name and in the same folder as your Illustrator file. If your Illustrator file is unregistered, it records the txt file in your home directory.

    // Color Modes To Text
    // ===================
    
    // Prints CMYK values, RGB values and HEX value of all selected swatches to a .txt file
    // The .txt file is saved with the same file name and inc the same folder as the .ai file
    // If the .ai file hasn't been saved, the .txt file is saved in the users home directory
    
    main();
    function main()
    {
        var doc = app.activeDocument;
        var selectedSwatches = doc.swatches.getSelected();
    
        if (selectedSwatches.length > 0)
        {
            var text = "";
    
            for (var i = 0; i < selectedSwatches.length; i++)
            {
                var swatch = selectedSwatches[i]
                var color = swatch.color;
    
                // Spot
                if (color.typename == "SpotColor") {
                    text += color.spot.name + "\n";
                    color = color.spot.color;
                }
    
                // CMYK Source
                if (color.typename == "CMYKColor")
                {
                    // CMYK Values
                    text += "C=" + Math.round(color.cyan) + " M=" + Math.round(color.magenta) + " Y=" + Math.round(color.yellow) + " K=" + Math.round(color.black) + "\n";
    
                    // RGB Values
                    var rgb = convertColor("CMYK", "RGB", [Math.round(color.cyan), Math.round(color.magenta), Math.round(color.yellow), Math.round(color.black)]);
                    text += "R=" + Math.floor(rgb[0]) + " G=" + Math.floor(rgb[1]) + " B=" + Math.floor(rgb[2]) + "\n";
    
                    // HEX Values
                    text += rgbToHex(Math.floor(rgb[0]), Math.floor(rgb[1]), Math.floor(rgb[2])) + "\n";
                    text += "\n";
                }
                // RGB Source
                else if (color.typename == "RGBColor")
                {
                    // CMYK Values
                    var cmyk = convertColor("RGB", "CMYK", [Math.round(color.red), Math.round(color.green), Math.round(color.blue)]);
                    text += "C=" + Math.round(cmyk[0]) + " M=" + Math.round(cmyk[1]) + " Y=" + Math.round(cmyk[2]) + " K=" + Math.round(cmyk[3]) + "\n";
    
                    // RGB Values
                    text += "R=" + Math.floor(color.red) + " G=" + Math.floor(color.green) + " B=" + Math.floor(color.blue) + "\n";
    
                    // HEX Values
                    text += rgbToHex(Math.floor(color.red), Math.floor(color.green), Math.floor(color.blue)) + "\n";
                    text += "\n";
                }
            }
            saveTxt(text);
        }
        else {
            alert("No Swatches Selected.");
        }
    }
    
    function convertColor(src, dest, clrArr)
    {
        return app.convertSampleColor(ImageColorSpace[src], clrArr, ImageColorSpace[dest], ColorConvertPurpose.defaultpurpose);
    }
    
    function componentToHex(c)
    {
        var hex = c.toString(16);
        return hex.length == 1 ? "0" + hex : hex;
    }
    
    function rgbToHex(r, g, b)
    {
        return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
    }
    
    function saveTxt(txt)
    {
        var name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
        var path = (app.activeDocument.path != "") ? app.activeDocument.path : "~";
    
        var saveFile = new File(path + "/" + name + ".txt");
    
        if(saveFile.exists)
            saveFile.remove();
    
        saveFile.encoding = "UTF8";
        saveFile.open("e", "TEXT");
        saveFile.writeln(txt);
        saveFile.close();
    
        alert("Saved to File:\n" + saveFile.fullName)
    }
    
  • color, PSC 2400 part #H100632782 graphics display is bad.

    Graphic color display port H100632782 number is bad. It is on the HP PSC 2400 photosmart all-in-one series. The display over a period of time just disappeared. The chassis number is CA02124640-0001 model 5610.  I found another number of piece that can work in his place, he is 7Rh100680782.  All these suppliers I checked, no longer have the part available. I use this printer for a MacBookPro.  The software is Mac OSX version 10.7.5. Any help is greatly appreciated.

    CB

    HP Partsurfer site lists the display as Q3083-60016.  It is no longer available through HP, but you may be able to find a replacement with a Google search.

  • Coloring a label partly

    Hey guys,.

    I wanted to ask a simple question. Is it possible to have a Label whose text contains several different colors. As in the example, assume that there is a label and its text is: "click here to open the notification history.  I want to 'Click here' part to be blue and "history of notification" to be red. So the label will become

    Click here to open the notification history.

    Is there a solution outside the creation of 3 different labels and put them side by side?

    Thank you for your help.

    You should be able to do it with html

    See
    http://supportforums.BlackBerry.com/T5/native-development/change-color-just-for-specific-word-in-a-L...

    using the bar often allows research to solve a problem

  • Cannot apply pipette color samples to type

    This is a strange problem I experience with Illustrator CC release 2015.2.0.

    In previous versions, I used to be able to select or direct select type (text box) and sample a color of this type using the eyedropper tool.

    When I try to do that in the latest version, the chart suggests that the type is a new color, however it is not change/display. It will change if I select characters (selected text). This means that if I want to do the update of type group, several text boxes to the times or hidden, I have to dig the content until I can select the text. It's a lot of work!

    What I found a group called 'type' (this is when the text box is selected) shows the new color - in the nuances and the appearance Panel. When he select text/characters, the color chart and the appearance Panel to refer to a new group called characters. If I change the color of the characters, the color will update. Follow me?


    So, I ask, does someone knows how to make the color of the group 'type' to replace the color of the group "character"?



    EXAMPLE:

    This image shows what the appearance Panel call group of 'type '. Selected in this way, the text will not taste the blue.

    Screen Shot 2016-01-19 at 10.53.42.png


    This picture shows that calls 'character' appearance group of panels. Selected in this way, the text will enjoy the blue.

    Screen Shot 2016-01-19 at 10.54.07.png

    I can reproduce it exactly, and it seems to be normal behavior. You have an extra padding added to the characters that should not be there, in addition to fill already applied to the characters. Simply remove the fill and the text should allow you to use the pipette with her again.

    Unfortunately when I do that, it removes the type too (not only the fill color)

    Which is impossible... you do like the video? Perhaps that the characters are colored white, and you just can't see them once you remove the extra padding...

  • How to remove colors custom Script UI control?

    Dear forum,

    I am writing a script for batch renaming links in InDesign.

    1.jpg

    If the user types the text edit field the new name which coincides with name of the original link (1st static text in the Group), the script gives a warning and he painted red.

    2.jpg

    3.jpg

    When the user solves the problem by making the new different name, the script he painted black.

    15-11-2015 20-30-37.jpg

    Here's where I got so far:

    g.et.onChange = function() {
        if (this.parent.children[0].text.replace(/\.[^\.]+$/, '') == this.text) {
            alert("\"" + this.text + "\" - the new name is the same as the old one! The file won't be renamed.", "Error", true);
            this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [1, 0, 0], 1);
        }
        else {
            if (this.graphics.foregroundColor != undefined) {
                $.writeln("Names are different: change the name from red to black.");                        
                this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [0, 0, 0], 1);
            }
        }
    }
    

    "g" is the text in a group.

    I wonder, is there a way to reset the color to the default text instead of repainting it?

    Currently, it checks if foregroundColor of graph is not undefined - which is painted with "newPen" - and if it is true, he painted black. But I guess it is a clumsy workaround and there should be a good way to do this.

    Kind regards

    Kasyan

    Hi Kasyan

    Pre CC could set the color to null, CC, this causes an accident.

    PS there are other options (color theme), but not on ID so paint is the only option I know.

    The challenge is dealing with default colors that depend on the setting. To change the text in the foreground is always black background colors you can either take the approach here Re: Re: Re: Re: ScriptUI: element of change to the default color

    Or a longer but more effective approach would be to go pass 100 values possible topic and get the associated rgb values.

    Probably not interesting put in a lot of effort as the way things are going THAT SUI will not support editing text in a few years.

    Concerning

    Trevor

  • How to change the color of a part of an object

    As you can see in the image below, I have a log on a layer in AI CC.  I want to do the part of the log that is inside the water appears blue to give the illusion of being under water.  The image below is a rough mock-up I made a screenshot of the image to HAVE in PSD.  Any ideas on how to do this in AI CC are appreciated.  Thank you.

    log.jpg

    Copy the form of water and river banks.

    Apset before

    Pathfinder palette > less Fornt

    Move the new shape of water on the log, release your layers and dragging the square colored layer unlocked over the newspaper (to the right of the layers palette).

    Set transparency around 50%. Change the mode of fusion also if you wish.

    I can't hear too good on one ear, then we will have to share a nickname tag.

  • Dvvswitch script part 3 - adding of VMK Ports to a dVs - LucD

    I'm trying to use your functions to add ports vmk to an existing dVs

    My syntax is:

    $dvkernname = new-dvswvmKernel -esxname $vmhost.name -dvswname $dvs -dvpgname $nfspg -ipaddr $nfsip -ipnetmask $dvsMask
    

    I set these variables earlier in my script

    I have the following error:

    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is nu
    ll or empty. Supply an argument that is not null or empty and then try the comm
    and again.
    At Functions\dvsw_functions.ps1:55 char:40
    +     $dvSwPg = $dvSw.Portgroup | %{Get-View <<<<  $_} | where {$_.Name -eq $dv
    PgName}
        + CategoryInfo          : InvalidData: (:) [Get-View], ParameterBindingVal
       idationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
       ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
    
    Exception calling "AddVirtualNic" with "2" argument(s): "A specified parameter
    was not correct.
    PortConnection.portgroupKey"
    At \Functions\dvsw_functions.ps1:71 char:29
    +             $hostNetSys.AddVirtualNic <<<< ($null, $nic)
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    I see that when you have published the functions you have stated your variables within the function .ps1. I am confused on how to use it. Depending on what environment processes my script, my variables change before passed to your function.

    Thanks for the comments.

    Attached script revamped for my post in part 3. This is the Get-dvSwitch function that has changed.

    You can try these functions and see if it works for the creation of a console or a portgroup VMkernel on your Nexus dvSwitch?

    The code example in its use (line 96) should give you an idea on how to use these functions

  • All the world has noticed that the color sampler tool is inaccurate?

    I have some colors of the company I can't vary.  I'm a solid with the appropriate hex values, and if I try to enjoy this solid later... it does not pick up the exact color.  I have to type the color values in the new solid.  I checked the color on the strong original values and they were right.  Someone knows what the deal is here?  It has been bothering me for far too long.  Thank you!

    When you say you "as solid sample", what exactly are you clicking on in After Effects? Are you clicking on the solid in the Composition Panel? Or are you clicking on the color chart for this layer in the timeline panel or project panels?

    There is a known bug that the color swatch in the Assembly or project panels may not return the value of the appropriate color to the color swatch tool. When you click on a pixel that is not in a pane of the Viewer (Composition, layer, film), After Effects application the pixel color display driver is. The problem here is the color management: even if you have not enabled the management of colors (via a workspace Project) in the project settings, After Effects within the parameters of color management for your monitor, as shown in the operating system (defined in system preferences in Mac OS X, the control panel under Windows). However, this applies only to the viewer panels. The nuances in the editing and project panels are not color managed in this way, so the color values, indicated by the display driver may be different from the color used by the associated layer. The only way to work around this bug would be to set the color profile of your monitor to a standard RGB profile; I wouldn't recommend actually do.

    If you have another case where the sample color tool does not return the color expected, please file a bug with details about what you are doing: http://adobe.com/go/wish

Maybe you are looking for