Using Lasso tool with co-ordinates via script

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

veryconfusedman
Posts: 1
Joined: Mon Dec 18, 2017 3:45 pm

Using Lasso tool with co-ordinates via script

Post by veryconfusedman »

Hey guys,

Joined up as i am very lost. i want to be able to pass in coordinates for the lasso to follow.

For example i have these coordinates that would trace a line around a person. here are some of them.

[ 1988.5, 2696. ],
[ 1988.5, 2695. ],
[ 1988.5, 2694. ],
[ 1988.5, 2693. ],
[ 1988.5, 2692. ],
[ 1988.5, 2691. ],
[ 1988.5, 2690. ],
[ 1988.5, 2689. ],
[ 1988.5, 2688. ],
[ 1988.5, 2687. ],
[ 1988.5, 2686. ],
[ 1988.5, 2685. ],
[ 1988.5, 2684. ],

i want to be able to input this array into a lasso tool and create that line.

Any ideas? i know how to use a rectangular tool with 4 positions so that i can draw a box around the person but i want it to be more accurate hence the lasso tool.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Using Lasso tool with co-ordinates via script

Post by Kukurykus »

As you probably know you can use for example: activeDocument.selection.select([[1990, 2696], [1988.5, 2695], [1988.5, 2894], [1900, 2893]]), but in case of provided coordinates it won't work, as there are horizontal points located in one vertical line (1988.5). There must be space between points that they're creating some shape. If you know all your coordinates and you're sure they gives trace around person, then there is no problem to put all pairs inside of activeDocument.selection.select([]), even if there are more of them than 3 or 4.