Get stroke color of shape

Hi,
I need get stroke color of shape in photoshop, but I only find how to get fill color, any suggestion?
function getFillColor() {
   var ref = new ActionReference();
   ref.putEnumerated( stringIDToTypeID( "contentLayer" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));
   var ref1= executeActionGet( ref );
   var list =  ref1.getList( charIDToTypeID( "Adjs" ) ) ;
   var solidColorLayer = list.getObjectValue(0);      
   var color = solidColorLayer.getObjectValue(charIDToTypeID('Clr '));
   var fillcolor = new SolidColor();
   fillcolor.rgb.red = color.getDouble(charIDToTypeID('Rd  '));
   fillcolor.rgb.green = color.getDouble(charIDToTypeID('Grn '));
   fillcolor.rgb.blue = color.getDouble(charIDToTypeID('Bl  '));
   return fillcolor;
Thank you

Does this work in Photoshop CC? (edited)
// 2014, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( stringIDToTypeID("contentLayer"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var strokeSt = layerDesc.getObjectValue(stringIDToTypeID("AGMStrokeStyleInfo"));
var strokeStyleColor = strokeSt.getObjectValue(stringIDToTypeID("strokeStyleContent")).getObjectValue(stringIDToTypeID("color"));
alert (strokeStyleColor.getDouble(stringIDToTypeID("red"))+"\n"+strokeStyleColor.getDouble(stringIDToTypeID("grain"))+"\n"+strokeStyleColor.getDouble(stringIDToTypeID("blue")));

Similar Messages

  • PATH CONTROL?  Selection of, changing fill and stroke colors, moving & arranging?  WHEN

    When is "Ideas" going to have BASIC, vector and path controls??? 
    The ability to select, move and arrange individual paths? 
    The ability to fill and change stroke colors?
    Shape tools?
    I would've expected this from the start.  This is not 1988 all over again... or is it?
    And what's this racket with "layers"?  You charge a premium for the app and then want people to pay again for simple features?  Layers would be less important if the app could do what it should to begin with. 

    Hi Mark,
    Please post ideas for improvements using the Submit an Idea button, please post each idea as a separate thread, this is so others can vote on the idea if they had the same one or like the idea, The product team reviews these when considering what features to add.
    I'm not really sure why Adobe has the option for additional layers as an in app purchase but you could create an idea post to request this changed as well.
    -Dave

  • PS CS6: stroke color picker preview in real time not working

    re: NEW color picker stroke color not updating in real time (previewing).
    Is it me or has the stroke color preview been removed in CS6 or is there a setting that needs to be changed to enable it?
    The problem: When I create a shape layer, press enter and then chose a stroke color from the color picker, I select a color but it doesnt update the stroke color until I press enter. I'm sure it used to change in real time as you clicked on the color picker panel before accepting it.
    Any sugestions or ideas as to whats going on or am I going mad?
    Further update: This is when creating a shape but using the new stroke feature in the properties bar at the top (the one which gives you the new fancy options like having a dashed, transparent or gradiented stroke) and not the traditional method of adding it as an effect. This still shows a real time update, but the new method doesnt.

    Curt Y wrote:
    zarrdave wrote:
    You're then moving the colour picker dialogue box to one side so you can see he shape created, and you've then tried clicking on different colours and the border color has changed after each click (but before you press OK)?
    If thats working so the color changes in real time for you, then unfortunatley I've got a problem with my version.
    Using Win7 CS6 extended, and following your instructions it works for me.
    Border changes withn I click on color pallet with color picker.
    Odd, same version/ O.S. here, thanks for that though Curt Y. Are you sure you're not clicking on the preset colours and actually using the color picker dialogue box.
    I've been in a bit of a rush here at the office and appologise for not being clearer and posting a screencap earlier.
    To clarify, its the Cyan dialogue box not the orange box I'm talking about  (nice choice of colours I know ). The top right icon in the organge box with the colours in is how you get to it.

  • Removing fill colors from shapes?

    I drew some squares using shape layers and filled them with white and added a stroke using layer styles.
    How can I remove the white fill color and make them transparent so they reveal the layer underneath?
    Thanks.

    Doing this gets rid of the stroke I applied through Layer Styles. How can I keep a stroke around the shape?

  • Problem with stroke color and weight

    I have an illustration of a chair I am working on using Illustrator CC.  It is made up of a combination of shapes and open paths.  In order to get the illustration filled correctly I used live paint to fill the open paths.  I was in the process of adjusting the stroke weight and colors but one stroke will not allow me to make any changes.  The stroke color is marked witha  question mark and the weight will not change at all.
    Update:  I have since posting this copied my artwork and pasted it into a new document.  I was able to correct the stroke on the problem path, but now there is an entire section of the chair which will accept no fill...
    Any help is appreciated.

    If I were you I would provide a sample .ai file and include some instructions to reproduce the issue you're talking about.

  • How can I apply a current fill color to a stroke, then adjust that stroke color's build?

    Hi all, I'm trying to figure out a way to automate a simple, yet repetative process I do countless times a day. Ideally, I'd like to tie it to a keystroke to speed up my workflow.
    I work on line art and colorways for footwear, so the way I'm coloring these shapes and strokes helps to break apart the different materials and pieces of the shoe.
    While coloring line art, I work with Pantone spot colors as fills for closed path objects. I then have to manually apply that same color to the stroke, set the stroke to 0.5px weight, convert that spot stroke color to CMYK, and add 15% to the K value.
    I found some code in an older post for applying the actively selected object's fill color to the stroke, but I'm having but I'm having trouble with the next step of figuring out how to take that spot stroke color and convert it to a CMYK build that I can then add 15% black to. Is this something that's even possible? I've spent about an hour playing with the script and have only had luck matching the fill color or turning the stroke white. Thanks for the help!

    ok try this one, I added the spot color option
    // make stroke color same as fill color + 15% black increase
    if ( app.documents.length > 0 && app.activeDocument.pathItems.length > 0) {
        for (var a=0; a<app.selection.length; a++) {
            try {
                    var sel = app.selection[a];
                    var fillcolor = sel.fillColor;
                    if (fillcolor.typename == "CMYKColor")
                        var cmkycolor = fillcolor;
                    else if (fillcolor.typename == "SpotColor")
                        var cmkycolor = fillcolor.spot.color;
                    var col = new CMYKColor;
                    col.cyan = cmkycolor.cyan;
                    col.magenta = cmkycolor.magenta;
                    col.yellow = cmkycolor.yellow;
                    var black = cmkycolor.black + cmkycolor.black +15;
                    col.black = black>100 ? 100 : black;
                    sel.strokeColor = col;
                    sel.strokeWidth = 0.5;
            catch (e){alert(e)

  • How to find out the textframe contains "stroke color" (or) "fillcolor"?

    How to find out the textframe contains "stroke color" (or) "fillcolor" via javascript. Kindly advise me with sample.

    I know, this post is quite a while ago, but: This simply does not work for me. Neither for simple PathItems, nor for the characters of a TextFrame.
    Working on: Illustrator CS5.5, Mac OS, Javascript
    Simple example:
    var numSelectedObjects = app.activeDocument.selection.length;
    // If any objects selected: Get fill and stroke color of the first one
    if(numSelectedObjects > 0){
    alert("Fill Color: " + app.activeDocument.selection[0].fillColor + " / Stroke Color: " + app.activeDocument.selection[0].fillColor);
    This returns always CMYKColor, RGBColor or GrayColor, even if there is no Color assigned to the objects stroke or fill!!
    For PathItems there is the attribute ".filled" or ".stroked", which returns "true" or "false" and is reliable.
    if(app.activeDocument.selection[i].filled){ // works fine with PathItems!
    Is there anything similar for Characters? I tried this one, but it does not work (because I think it does not exist):
    if(app.activeDocument.selection[i].textRange.filled){ // does not work!
    I just need to find out, if the characters in a textfield have got a fill or stroke color. Reliable.
    It would be very nice to get help from anybody!
    Thanks a lot in advance!

  • Using a script to get the color of a colorized Black & White Bitmap image

    I've been running into this wall for quite some time and would greatly appreciate any help that can given for it.
    I have an Illustrator script that runs inside of a BridgeTalk session within an InDesign script.  Yeah, it's complicated.  The upshot is that the Illustrator part opens up an EPS file, looks through all objects on a certain layer in that file, and returns an array of the colors used in it.  So, it looks at fill colors, stroke colors, gradient stops, etc.  One of the biggest stumbling blocks (next to PlugIn Items, which I'll ask about in a separate post) is getting the color of raster images.
    Most raster images, I realize, are going to be CMYK or RGB images, but our company mostly deals with either Grayscale images or Black & White Bitmaps that are embedded in the EPS file.  Those two allow the ability to colorize them by simply selecting them and then choosing a color, such as a spot PANTONE color from one of their color books.
    Now, I need the script to read the color that the raster image has been colorized with.  This works okay for images that have a GrayScale color space, as the script just looks at Colorant[0] of that image.  However, I run into a problem with Black & White Bitmap images.  Here's a piece of code that I try to make work with an EPS file that has a raster image:
    var document = app.activeDocument;
    for (var i = 0; i < document.layers[0].pageItems.length; i++) {
              // Stepping through each item on the layer.
              var currentItem = document.layers[0].pageItems[i];
              $.writeln("Current item is " + currentItem.typename);
              $.writeln("Number of channels is " + currentItem.channels);
              $.writeln("Color Space is " + currentItem.imageColorSpace);
              $.writeln("Colorized Grayscale? " + currentItem.colorizedGrayscale);
              $.writeln("Number of Colorants: " + currentItem.colorants.length);
              for (var j = 0; j < currentItem.colorants.length; j++)
                        $.writeln("Colorant number " + j + " is " + currentItem.colorants[j]);
              $.writeln("Its parent is " + currentItem.parent);
              $.writeln("Parent's typename is " + currentItem.parent.typename);
    This code runs successfully on an Illustrator file that has a Black & White Bitmap image on the top layer, but if you try and run it, you'll see the problem:  Even if you've colorized your Bitmap image with a PANTONE spot color (and the script even returns "true" on the line "Colorized Grayscale?"), Colorant number 0 is "Gray".  It should be the spot color assigned, not "Gray".
    Can anyone please help me figure out how to get the script to recognize the actual colorant of a Black & White Bitmap image in Illustrator?

    If you're a professional photographer with 50,000 pictures stored now and more coming all the time, you need to forget about using iPhoto and get yourself some professional-quality digital asset management software. iPhoto is not meant for people like you, and instead of providing a simple, elegant one-stop answer to all your needs, iPhoto is actually complicating your life.
    You need an application that will:
    - catalog ALL your images and keep track of where they are, no matter how many DVDs, folders, partitions or hard drives they're spread over;
    - display thumbnails of ALL of them, even when the DVD that contains them is not present in any drive, so you can select all the ones you want for a project;
    - find and copy (or export) the originals of all the files you've selected in the browser window, even if it means prompting you to insert the necessary DVDs for all of them.
    I suggest Googling "digital asset management software Macintosh" and seeing what turns up. I used to use an old version of Extensis Portfolio, and even that would have been better for your purposes than iPhoto is.

  • How do I auto set stroke weight, stroke colors & fill color?

    Hi,
    I'd like to make it easier for our 100,000 designers to use AI to make custom products using a laser cutter.
    Current Practice
    Designers open our AI laser cutting design templates, add their designs using the AI settings our online pricing system can read, then upload their designs to our website for instant pricing, making and shipping.
    The Problem
    Designers have to manually setup AI with settings that can be read by our online pricing system. If they get these settings wrong, our system can not read their designs. So they are rejected and can not be priced or made. This happens more often that you'd imagine.
    The Solution
    Designers do not like design rejections. So I'd like to eradicate them by providing our designers with a version of AI that provides the following settings only:
    * Set document to RGB
    * Stroke weight = 0.01mm
    * Stroke colors = RGB 0, 0, 255 and 255, 0, 0
    * Fill color = RGB 0, 0, 0
    This will mean designers have a very limited number of AI choices, with nothing to distract them or to get wrong. Which will result in less (or zero?) design rejections. And products made faster than before. Rejoice!
    Question
    How do we program our AI laser cutting design templates so that when they are opened in AI, they auto set AI settings as defined above?
    Thanks so much.
    Derek

    Ponoko wrote:
    Your first point - yes, that's what our system does currently. As a result designers get lots of 'how to fix' messages as a result of design rejections. We wish to reduce these rejections and resulting 'how to fix' messages by limiting their choices in AI - because this is where the problems are created.
    Ok, yeah gotcha, so customers/designers think they do it right (cough/laugh) upload, then get surprised to find out they didn't by your upload system. That's kind of what I thought. I feel your pain. ;-) I sense you want to reduce this aspect to keep the customers/designers happy and thinking they do nothing but work magic all day right? ;-) So you don't want to lose customers in the midst of frustration of file rejection thinking there files are right and your system is certainly wrong, when in fact it's the opposite. Good luck explaining that to a designer however, right? ;-)
    Ponoko wrote:
    Your second point - You go on to talk about using a complex "action" we could distribute within the design templates. Although I suspect this is different, the path we're thinking is to include something in the templates that, when imported into AI, sets AI with the color palette we need, line weight we need. Possible?
    As Monika hinted at you can't rigidly restrict or control what a user is allowed to do and use in Illustrator. You can try to reduce the parameters by saving the file as a Template.ait file, but even then they can muck about all day until they mess things up again, plus you have no control whatsoever even then as to whether they use fills, the stroke weights, etc. That is why I mentioned various things to manipulate the file once they deem it completed and ready to submit/upload. Basically a method to fix what they messed up or did incorrectly and instead set things as they should be for submission as I previously mentioned. I mentioned you may be able to create a complex Illustrator "action" action.aia that they run to process these requirements. I am not sure if such an action could be accomplished as all inclusive (perhaps though) otherwise you could as stated do it through scripting and a script they run: script.jsx to prepare the requirements, or an actual standalone helper app you create and provide like I mentioned above as well.
    I see for CorelDRAW & Inkscape you require SVG, why not change that for Illustrator also so all your 2D app submissions are SVG based? Then manipulate the SVG server side, point out the changes and why and have the customer approve the new modified SVG Preview of the needed changes and move along with the process from there? Make all the requirement changes on the server by manipulating the SVG. You should have access to all of the requirements: RGB color model, stroke weight, stroke colors, fill colors, create font outlines, image tracing? I am just tossing out ideas here, get your programmers busy, tell them to stop playing video games and "make it so". ;-)
    But even so, this then begs the question: What are you doing to circumvent the same issues for inept CorelDraw and Inkscape users?
    Since, they have the same freedom to do things incorrectly and misaligned with the requirements, just as Illustrator users do.
    Regardless though of the approach customers/designers may not like seeing certain things changed even minutely in trivial amounts and thusly be just as upset or up in arms with the changes to their pretty design files that they think were not needed in the first place, how dare you undermine them ;-). Same as seeing the file rejection from your system upon upload. Again I feel your pain. You have your Application/File requirements requirements stated nicely and plainly, it should be pretty easy for most, but sadly I guess not.

  • Can  not get any color swatches into Gradient Swatch panel.

    I've tried dragging, clicking dragging and only get the circle/line-thru-it.  And there is no New Gradient Swatch option anywhere that I can see.
    Listen:  I've now spent over 4 hours online -- today alone! -- reading instructions that simply do not work. After 4 years of InDesign work and design changes made because I can't get two colors to simply gradient, its time for this function to work for me.

    You have at least two possibilites to add gradients to your swatches:
    1. Select an Object with a gradient applied. (Take care to have the gradient part selcted in the stroke/fill part in the tool panel.) Got to the Swatch Panel and in the menu of the panel select "New Gradient Swatch…"
    or
    2. In the swatch panel menu got to "New gradient Swatch…", edit the color stoppers, add some ore remove some and click on the add or ok button.

  • How do I change the stroke color while retaining the fill color using eye dropper in Illustrator?

    I have a question regarding illustrator.
    Let's say I have a circle with blue fill and red stroke. And I place an image in the illustrator file. Now I want to change the red stroke of my circle to let's say a purple color by sampling the color from the image.
    How can I achieve that with a eye dropper tool? Every time when I try to sample a color from the image, the whole circle will change to purple instead of just the stroke?
    I have tried multiple key combination, shift, alt, ctrl but they all don't work.
    Cheers, Venn.

    What you were saying is essentially what Mike's screenshot is all about?
    Deselect Focal Fill on Picks Up and Applies.
    I don't see how disabling them will help?
    If you have an image, Illustrator reads it as a transparent shape without any appearance attributes.
    Now I have a shape with a stroke, I want to change the stroke color by sampling the colors on the image.
    You can't do that with the eyedropper because the image doesn't have a stroke.
    Eyedropper only picks and applies appearances.
    So I guess you can't do this in Illustrator from the beginning.
    The eyedropper isn't built for that.

  • Can't change the weight of my strokes, color or fill...

    I use artioscad wich has a plug-in for illustrator. When I'm working with illustrator i can't change the weight of my strokes, color or fill, in fact i can't do anything, everything is locked. I have tried to unlock the draw but with n o sucessm can anyone help me?? I have to make the illustrations for the boxes I draw and using *.eps file is not my solution.

    Hi Megan,
    Thanks for the replay.
    I have tried many thinks, and tried what you wrote, but nothing. I'm new in this artioscad-illustrator, so probably I'm making something wrong. I just draw in artios and open directly in illustrator using esko plug-in.
    I tried again what to told me to trie but with no luck.
    I'll pass you a step-by-step what I made after oppening in illustrator:
    I'll make my steps for you to undersatnd whats hapening.. because I have tried looking the appearance palette.. and its ok.
    First i draw in artios, its a package software design which has a plug-in for illustrator (to open directly artios drawings in illustrator)
    Then in illustrator i open it directly, the aspect is like this:
    I unlock the chain of the layers and in the appearence palette apears just plug-in object.
    I can select an individual path but can't change it. If I make a offset path with 0mm, I can change that path weight but not the original. But if i try to move the offset path or the original path it gives me an error "Can't move the objects. The command was canceled"
    I have tried so many things that, realy, I can't remember all. I
    have a menu that has more options, but none of them unlock the paths. Every time try to drag an anchor it goes right back to the original position.
    The goal is to make something like the next image:
    Today I dupplicated my layer and then made a offset 0, now I can change the weight, color and fill my shape. Probably I will find more problens in the way. This was the only solution that worked with me!

  • Automatically set the stroke color as fill color

    Hello all,
    I have a file with two squares with red and blue fill colors respectively and transparent surrounding strokes. I'm trying to find a way to automatically set the stroke color of each square to the respective fill color.
    Is there an Illustrator script somewhere that would achieve that? I am not aware of an internal Illustrator command for this purpose.
    Thank you

    I'm not a scripting guy at all, but getting an object's fill color and applying it elsewhere sounds like it should be scriptable. You should post the question in the AI Scripting Forum.
    The hitch I see here is your assertion that your objects have "transparent surrounding strokes." I could be wrong, but I believe there is actually no such thing in Illustrator. Through some simple experimenting, I conclude that an object's stroke set to "no color" by choosing the blank swatch actually becomes a stroke of undetermined, or perhaps zero, weight.
    Take an object with a stroke color and weight and set its stroke to no color. The weight goes away as well. One can't exist without the other, and vice-versa, with repect to stroke weight and color. Now enter a weight for that colorless stroke, and it again receives color; defaulting to black regardless of what it may have been previously.
    Similarly, if you assign a color where there is no weight, a 1-point weight appears by default.
    I'm not sure how/if that plays into your plans, but I just thought I'd ramble on about it here in case it's something you hadn't considered.

  • How to get background color in MVC programming

    Hi Experts,
    I am new to BSP.
    I am working in CRM 7.0 version and designing a view using MVC method in BSP.
    I have two doubts::
    1. How can i get background color in a view ?
    2. How can i attach a picture, that is in paint-brush, in background ?
    Thanks in Advance.
    Nitin Karamchandani.
    Edited by: Nitin Karamchandani on Jun 3, 2009 8:10 AM

    Hi,
    several html tags have the attribute bgcolor, like
    <body bgcolor="red">  or <body bgcolor="RRGGBB">  where RR, GG, BB is an hexadecimal value according to RGB color palette.
    you can also work with CSS and in this case you affect the attribute style, which is also available in several tags:
    document.body.style.backgroundColor="#EEEEEE"

  • The app icons I have on the iPad have just come up blank with the app name under it. How do I get the colorful icons to appear? The apps do work though

    The Ipad icons are all just a grey box. How do I get the colorful icons?

    First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

Maybe you are looking for

  • Razr V3 contacts to Address Book?

    When isync Razr to Address Book, only 28 or 120 contact transfer. Discovered that contacts saved in SIM do not transfer, only contacts saved in phone book. Do I have to go to each contact and change to "save in phone?" Is there another way of accompl

  • Lumia 920 micro usb -- vga ?

    Hi, I wonder if it is possible to use a Lumia 920 and a projector with a "micro usb to vga" cable? Thanks in advance!

  • Error is Shiiping point  in Sales order

    Hi friends, Ship.condition  loading grp 0001 plant SF01 StLoc PR03 not defined I have a material which has been created in storage location PR03. I am trying to make a sales order but when i try to save the sales order order I am getting the above er

  • I Pad PS touch doesn't seem to do what is expected

    Just downloaded I Pad touch , started tutorials only some worked for example STOP sign would not change color. Also cannot select scribble tool . Will I have to re download app. Any help . Black & tan

  • Error during Enhancing IT0008

    Hello experts, I added new fields to IT8 through PM01 successfully. Now when the user tries to use the IT8, we getting error that data not available it table T777D. When I cross chk the development with the production (my change request is not yet tr