Script with magic wand

I noticed there's no documentaion on scripting (javascript) with the magic wand selection. I'd assume that it's along the lines of magicwand.(X,Y).tolerance.contigious.true.samplealllayers.true. or something like that. But it's guess work.
var id176 = charIDToTypeID( "setd" );
    var desc34 = new ActionDescriptor();
    var id177 = charIDToTypeID( "null" );
        var ref15 = new ActionReference();
        var id178 = charIDToTypeID( "Chnl" );
        var id179 = charIDToTypeID( "fsel" );
        ref15.putProperty( id178, id179 );
    desc34.putReference( id177, ref15 );
    var id180 = charIDToTypeID( "T   " );
        var desc35 = new ActionDescriptor();
        var id181 = charIDToTypeID( "Hrzn" );
        var id182 = charIDToTypeID( "#Pxl" );
        desc35.putUnitDouble( id181, id182, 0.000000 );
        var id183 = charIDToTypeID( "Vrtc" );
        var id184 = charIDToTypeID( "#Pxl" );
        desc35.putUnitDouble( id183, id184, 0.000000 );
    var id185 = charIDToTypeID( "Pnt " );
    desc34.putObject( id180, id185, desc35 );
    var id186 = charIDToTypeID( "Tlrn" );
    desc34.putInteger( id186, 32 );
    var id187 = charIDToTypeID( "Mrgd" );
    desc34.putBoolean( id187, true );
    var id188 = charIDToTypeID( "AntA" );
    desc34.putBoolean( id188, true );
executeAction( id176, desc34, DialogModes.NO );
I've got the above by the old script listener and I was just trying to tidy it up (and learn a bit in the process)
Cheers

This is one of the things you can only do with scriptlistener. Here is one way to clean up the code.
function magicWand(x,y,t,a,c,s) {
    if(arguments.length < 2) return;// make sure have x,y
    if(undefined == t) var t = 32;// set defaults of optional arguments
    if(undefined == a) var a = true;
    if(undefined == c) var c = false;
     if(undefined == s) var s = false;
    var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') );
    desc.putReference( charIDToTypeID('null'), ref );
        var positionDesc = new ActionDescriptor();
        positionDesc.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Rlt'), x );// in pixels
        positionDesc.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Rlt'), y );
    desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Pnt '), positionDesc );
    desc.putInteger( charIDToTypeID('Tlrn'), t);// tolerance
    desc.putBoolean( charIDToTypeID('Mrgd'), s );// sample all layers
    if(!c) desc.putBoolean( charIDToTypeID( "Cntg" ), false );//  contiguous
    desc.putBoolean( charIDToTypeID('AntA'), a );// anti-alias
    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
You could clean it up more by adding data type checks for the arguments.

Similar Messages

  • Coloring issues with magic wand tool and paint bucket tool, leaves uncolored areas near drawn lines

    Photoshop CS6 doesn't color properly.  Whetever I use brush tool or elliptical marquee tool to do the lines (with brush tool I use Hard Round, not soft), it doesn't color the whole area when i fill them with color. This happens with both magic wand tool AND paint bucket tool, there is always a small uncolored area near the lines. I have tolerance on 30,  and anti-alias, contiguous and sample all layers boxes checked. (this setting worked on my old CS3) I have tried tolerance from 0 to 100, no difference. I have also tried unchecking the boxes I just mentioned, still no difference. I hope there is a solution for this, because it is tedious to always go to the Select - Modify - Expand every time I need to color some area. So how do I fix this problem? I use seperate layers for lines and colors, like I have always done with other Photoshop versions. Even in school where they have CS5 those normal settings work.

    Hello Chris,
    I don't think this is a "user error". I think Adobe should be able to program a state of the art paint bucket, which is capable to get this done right.
    Other applications are able to get this done right.
    Please don't fall into a programmer's ignorance ("this is done right by definition") but listen to us artists and improve this unintuitive behavior. Add something like "ignore transparent pixels", because this doesn't even work if you draw on an empty layer.
    Thank you!

  • Content Aware with Magic Wand¿

    I used to fill in gaps of missing Panos with content aware in CS5 using the magic wand and fill - content aware. In CS6 it fills it in with the foreground color. The only way I can get the content aware to work is if I make the selection with the lasso tool. The quick Sslection tool will not even select the area without pixels. Anyone else had this issue¿

    Thank you for the reply. Yes I selected the content aware option in the drop down; I have been using the content aware to fill in gaps in panos for a long time now. The issue is in the CS6 Beta when I use the magic wand to select the empty pixels, and there are a lot in places, it will only fill it with a solid color. Also the quick select tool will not even select empty pixels. The pano I have isn't that large, 35090 px by 3490 px, not near the type of panos Ben Willmore does for example. I just wondered if anyone else has this issue and if so is there a fix.

  • Refining white on white selection with magic wand

    I'm trying to remove the background from a BW image - a model posing in front of a white background.
    Selecting using the magic wand works fine except on the area where the light on the model fades skin to white.When I select, I get the hand and lower part of the arm (see below) but miss the upper, whiter area completely. I've tried all sorts of settings and also tried increasing the contrast using a brightness/contrast layer, but nothing I I can figure out allows me to keep the arm and remove the background while keeping the arm.  FWIW, the picture can't be reshot.
    How do I do it? Thanks for any help.
    EdB

    Instead of trying to do a completely automated selection, try using the Polygonal Lasso Tool.  It will allow you to select the edge of the arm where you feel it should be.
    If you want nice smooth curves, consider drawing a path around the edge of the arm with the Pen tool.  The advantage is that it allows you to adjust the path by altering points and bezier handles.  You can then use that path to create a vector mask, or convert it to a selection and delete.
    -Noel

  • Problems removing background with Magic wand and then brush tool

    I use Paint Shop Elements (version 13) to remove background from images to then use in PowerPoint. So I ensure the image is on a proper layer (say Layer 0).  I then create a mask.  If there are large areas of unwanted background I use the Magic Wand to highlight them.  I then use the Fill Tool with the 'black'/remove pixels leave transparent on these areas.  HOWEVER if I then try to use the Brush Tool with the remove/transparent 'black' setting to say tidy up the image, the brush tool will not respond!  I then find I have to save the Photoshop file and re-open it before I can use the brush tool.  I suspect I am missing a step, but I am fairly new to Photoshop Elements. 

    I don't know where this "tutorial" came from, but obviously it does not work for you. Try the following in PSE Expert tab:
    Have the Layers palette open
    Open the picture file
    Double click the background layer in order to convert it from a locked layer to a regular layer. It is now Layer 0.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the foreground
    Go to Select>Inverse
    Hit delete on the keyboard
    Press CTRL+D to get rid of the marching ants
    Use the eraser tool to tidy up
    Go to File>save as, and save in a file format which supports transparency - PNG is ok
    Import the processed file in to PowerPoint.

  • Magic wand selection to outlined border

    I have a white "O" on a varied background that I've outlined with Magic Wand, but I want to turn the running ants line into an actual black 3 pixel border. Is this possible? Or is there some other less simple way to do this? CS3/Mac

    Edit > Stroke

  • Photoshop CS6 Magic Wand

    Hi,
    When I select the area with magic wand tool and refilled, the edge of the selection is way rougher than before.
    This is before refilled.
    This is after refilled.
    How can I fix this?

    This is whole screen shot.
    and this is the image size.
    I'm quite interested in the story about alising.
    Could you tell me what and how I improve this?

  • How to do a magic wand tool like photoshop with java?

    in a JPanel,a bufferedImage with a great many colors show in it.
    now,i want to select a region with same color use a magic wand tool ,just like photoshop,how to do it?
    Thanks.

    maybe it is not a feasible way!
    i have loading a image size of 150*50,
    when i use getPixelColor() method as follow,it used almost 40 seconds to end it.it get correct info of every pixels,but too slow. say nothing of analysis the pixels and catch a selection.
    //*******the getPixelColor() method**********//
    public String getPixelColor(BufferedImage bimg){
    String info=new String();
    for(int i=0;i<bimg.getWidth();i++)
    for(int j=0;j<bimg.getHeight();j++){
    int rgb=bimg.getRGB(i,j);
    int red=(rgb>>24)&0xff;
    int green=(rgb>>16)&0xff;
    int blue=(rgb>>8)&0xff;
    info=info+"R:"+red+" G:"+green+" B:"+blue+" X:"+i+" Y:"+j+"\n";
    return info;
    //****end *****//
    then invoke method:
    System.out.println(getPixelColor(myimg));

  • Mine is i-phone 4  16G. Feel so sorry upgraded to IOS 7.0.4 which slow down my phone dramatically and less responsive with the touch screen. And in times it frozen on me, the worst. Anyone has the magic wand to downgrade the IOS back to 5 o 6...

    Mine is i-phone 4  16G. Feel so sorry upgraded to IOS 7.0.4 which slow down my phone dramatically and less responsive with the touch screen. And in times it frozen on me, the worst. Anyone has the magic wand to downgrade the IOS back to 5 o 6...

    There is no way to downgrade to a different iOS. Apple does not support downgrading. See this link regarding speeding up the iPhone 4. http://osxdaily.com/2013/09/23/ios-7-slow-speed-it-up/

  • Cannot find the Quick Selection Tool (previously paired with the magic wand tool) on Illustrator CC (newest version installed on October 14, 2014)

    I have just installed a new version of Illustrator CC and CS6 on October 14, 2014 and I couldn't find the Quick Selection Tool on this version, previously this tool is located with the magic wand tool

    I don't remember a quick selection tool in Illustrator. Are you sure this was in Illustrator?

  • Automatic whole object selection with lasso or magic wand tool.

    Here I have a circle pattern, all the fills are the same, all have the same appearance,
    when I try selecting all the internal scattered objects with the lasso tool, it only partially selects them, its slow getting around their borders while trying not to select the outer ring of objects, using the selection tool on this radial design is difficult, as when you select some pieces you deselect others, I was hoping for an option whereby you could tick a checkbox for the lasso or magic wand tool to "select whole object" when you run the wand or lasso over those objects.At the moment the lasso tool only partially selects based on which nodes you encircled.
    I cannot select the outer ring (would be just as difficult with selection tool) and use inverse because there are many other objects on the page also, I could have created the inner circle on another layer initially, but had not, in this situation a small enhancement to the magic wand or lasso would be good for selecting whole objects. When using experimental design approaches we don`t naturally pre plan every step or idea from the beginning.
    the other option is to select them all with lasso, the group them, move them then ungroup, but again just looking for the one step opportunity as it seems simple enough.

    Agreed. I think an "Grow" and "Grow All" option in the Select menu is the best way to achieve that. (Maybe Adobe can come up with better naming)
    "Grow selection" would increase the selection by one anchor point in each direction for each partially selected path.
    "Grow All" would select all the anchor points of each partially selected path.
    For example, if you have 1 point selected on a circle, "Grow selection" would add the 2 adjacent points to the selection for a total of 3 points. "Grow All" would select all the points on the circle.
    Another related feature would be an "Add to selection" option in addition to the "Save selection". And why not a "Substract from selection" option? You'd simply select a few points, choose add or substract and choose which saved selection to modify.
    A lot of the selection toold work at the object level, not at the point level, like Deselect/Reselect/Inverse. This can be frustrating.

  • Recommend an image editor that has a magic wand tool to delete white background and save as PNG with transparency

    Hi Everybody,
    I need an iPad app that can open an image and has a Magic Wand-type tool so I can select white background around a subject. Then delete the white areas so it becomes transparent. Then save as a PNG with transparency. I've tried Pixelmator...I can select the white but I can not delete the white. I downloaded Photoshop Express...no magic wand tool.
    Does anyone have any recommendations?
    Thanks,
    Gary

    It's a shame you don't have Mac. The feature is built in the system (in Preview, Pages, etc).
    That makes me think: this feature should be in the iPad iWork apps too (Pages and keynote): check out this guide: http://www.cultofmac.com/256475/knock-out-those-backgrounds-instant-alpha-hidden -in-pages-for-ipad-ios-tips/

  • What is wrong with my magic wand tool?

    I just started loading up photoshop to crop a picture and my magic wand tool has gone all funny.  i don't know why but instead of cropping all the white back ground it does this http://imgur.com/oDTxXyK
    someone please help me!

    Look at the tool options. You set the tolerance to 200, so it's going to select just about everything...
    Also, "crop" is not the right word there.  I think you meant "select".

  • I am new to Photoshop CC. I am trying to use the magic wand to highlight a dull sky, and it is just making a weird selection that has nothing to do with my photo

    I am trying to use the Magic Wand to highlight a dull sky so that I can add something more interesting.
    When I try to isolate this area, the magic wand seems to just make a random selection throughout my photo.
    I have anit-alias on, and my tolerance is at 5.

    First, is the layer containing the photo of the sky selected? That might help.
    But there are probably better ways to make selections than the magic wand, depending on the value ranges in the sky you wish to select.
    Try Color Range, Quick Mask, or manual selections using the Polygon Lasso Tool, or combinations of all of the above.
    You can also paint your selection on an additional layer (using brushes), and convert the painted area to a selection, make a channel of that selection, and refine manually.

  • Whereas in the past when I used the Magic Wand I got rid of it by using another tool or clicking on "escape", today the "escape" is not working. What should I do?I am working with Element 10

    Can somebody please advise me why Escape is not working anymore and how to get rid of the magic wand?

    At the far left of the options bar is a tiny triangle. Click it and choose Reset Tool and see if that helps.

Maybe you are looking for

  • HT1338 how do I import my hotmail calendar to my iCal on iMac

    I have been trying to add my hotmail calendar to show in my iCal but have not been able to do so on my imac. Does anyone know if it is even possible on Os X mountain lion 7.0?

  • Multiple Errors with New iTunes

    Hi Folks, What's up with the most recent version of iTunes. 1.  I'm trying to burn a CD (playlist) and iTunes is trying to analyze or "Determining the Audio Volume" for my podcasts.  It also says 225 and I don't have that many. 2.  Print a cover for

  • Extending 200 GLs from COA to company code level at one go

    Hello All, Wanted to know if there is any way of extending a list of GLs from COA level to company code level at one go? I had copied about 300 GLs at COA level using OBA7 and now want to extend about 200 of them to a company code. Is there any trans

  • Oracle9iAS and .swf flash from Macromedia

    I received a .swf file with connection via .ASP pages to a SQL-Server Database and want to change the environment to an Oracle 9iAS 8.1.7.3 Database. Since .ASP pages do not work in Oracle 9iAS : How can I manage to access the Oracle Database on the

  • CARSchedulerJobError

    Dear All, We are getting the following error at the RTMT. We are using the CUCM 7.1. Any idea? : 0: May 19 18:01:49.274 UTC : %CCM_CAR_SCH-CAR-3-CARSchedulerJobError: CAR scheduled job failed. Job Failure Detail:CAR Scheduler restarted, update ALL 1