Copy link to clipboard
Copied
Hi community !
I draw a lot of illustrations in illustrator, which are later interpreted in photoshop.
I have a script (javascript) that saves all the vector points (PathPointsInfo) of illustrator in a .txt file like this :
Path1;1;true;1775;1774;465.495299999999,-377.652822148496;465.495299999999,-377.652822148496;465.495299999999,-376.011522189959;PointType.CORNER
Path1;1;true;1775;1773;465.495299999999,-513.212618723967;465.495299999999,-514.85371868251;465.495299999999,-513.212618723967;PointType.CORNER
Path1;1;true;1775;1772;462.518899999999,-516.189018648777;462.518899999999,-516.189018648777;464.160099999999,-516.189018648777;PointType.CORNER
Path1;1;true;1775;1771;258.094499999999,-516.189018648777;240.584999999999,-516.189018648777;258.094499999999,-516.189018648777;PointType.CORNER
Path1;1;true;1775;1770;206.0826,-510.945518781239;189.510199999999,-507.554318866908;223.0857,-514.424718693347;PointType.SMOOTH
Path1;1;true;1775;1769;157.631599999999,-495.905519161181;142.338099999999,-489.436819324595;173.2089,-502.494118994739;PointType.SMOOTH
Path1;1;true;1775;1768;113.7894,-472.108819762337;100.1235,-462.876219995572;127.5874,-481.430419526853;PointType.SMOOTH
Path1;1;true;1775;1767;75.5941999999995,-440.594900000001;63.9159,-428.916720853461;87.2726999999995,-452.273520263419;PointType.SMOOTH
Path1;1;true;1775;1766;44.0802999999996,-402.399721523337;34.7585999999992,-388.601821871901;53.3130999999994,-416.065900000001;PointType.SMOOTH
Path1;1;true;1775;1765;20.2835999999988,-358.557522630884;13.6948999999986,-342.979899999999;26.752199999999,-373.851222244532;PointType.SMOOTH
Path1;1;true;1775;1764;5.24350000000049,-310.106523854858;1.76419999999962,-293.103324284395;8.6346999999987,-326.678623436213;PointType.SMOOTH
Path1;1;true;1775;1763;0,-258.094525168792;0,-240.5851;0,-275.604024726465;PointType.SMOOTH
Path1;1;true;1775;1762;5.24350000000049,-206.082700000001;8.6346999999987,-189.5104;1.76419999999962,-223.085800000001;PointType.SMOOTH
Path1;1;true;1775;1761;20.2835999999988,-157.631600000001;26.7523000000001,-142.338;13.6948999999986,-173.2091;PointType.SMOOTH
Path1;1;true;1775;1760;44.0802999999996,-113.789400000001;53.3127999999997,-100.123400000001;34.7585999999992,-127.5873;PointType.SMOOTH
Path1;1;true;1775;1759;75.5941999999995,-75.5942000000005;87.2727999999988,-63.9155000000001;63.9156999999996,-87.2727000000004;PointType.SMOOTH
This file is then used in Photoshop (always with javascript) to recreate all the paths.
but I have a problem whith the paths who had more than 1000 dots.
have you a soluce for keep theses big Path items whithout to cut ?
Thanks !
Romain
This script adds a path with two subpaths.
One contains 2000 points, the second 1500.
As you can see, everything works, while the DOM function throws an error.
try {
var pth = new Array();
var p0 = new Array();
var p1 = new Array();
for (var i = 0; i < 2000; i++)
{
p0[i] = new PathPointInfo();
p0[i].kind = PointKind.SMOOTHPOINT;
p0[i].anchor = [i,i];
p0[i].leftDirection = p0[i].anchor;
p0[i].rightDirection = p0[i].anchor;
}
for (var i = 0; i < 1500; i++
...
Copy link to clipboard
Copied
What is the problem you have with more then 1000 points is it just a performance problem that a lot of control points but I believe Photoshop supports that. I have never counted the points in this path. There lot of lag transforming and editing this path.
Copy link to clipboard
Copied
Hi JJMACK,
you use a copy/past enter illustrator & photoshop or use an importation of each dot with a script ?
Thanks !
Copy link to clipboard
Copied
Is this all on one path? I know there's a limit to path numbers, can't remember if it's 200 or 2000. Ran into the same issue transferring a path from IA. I had to do it in batches. I used an xml file to save the anchors and handles.
Copy link to clipboard
Copied
i have multiple path but some paths have more than 1000 dots. Test performed on 4 paths (293,802,922 & 1008 dots).
if my file .txt contain the path with 1008 coordonates, photoshop cannot recreate the dots.
I think Adobe has blocked in photoshop, the analysis of the number of coordinates at less than 1000 dots.
here :
"Joyeuses" = 1008 dots = 1 path
Star = 293 dots = 1 path
i think that the same problem that this :
Scripting Photoshop: path has too many points to be converted to selection? - Graphic Design Stack E...
Copy link to clipboard
Copied
I do not install AI. However I read in version 23 Adobe added Paste in as layers in Photoshop from AI. I also believe there has also been a way to pass Paths between AI and Photoshop. Have you tried either of these methods to transfer your AI Path into Photoshop. Why script it if those features work. In Photoshop I see a menu item File>Export>Path to Illustrator. Does AI have a menu item Export Path to Photoshop?
Copy link to clipboard
Copied
Yea, looks like the same issue. I'm not sure what you can to, if there is a limit and you have more than 1000 on a single path. I would think many if these limits are old, when computers weren't as powerful. Seems like Adobe could raise these limits now.
Copy link to clipboard
Copied
The DOM model does not allow creating a path with more than 1000 points. However, manually creating a Path with more than 1000 points is realistic. I'll see later what can be done using the AM code. There is no time now.
p.s. There can be 998 paths in the file. This is described in the PSD specification.
Copy link to clipboard
Copied
Time for a feature request, then...
Copy link to clipboard
Copied
I never tried to collect subPathItems anchorPoints to make a selection from them using DOM. I think I had no idea that is possible. I was doing it by much faster AM only.
Copy link to clipboard
Copied
Hi @*Romain*
Have you tried using the Simplify command from the Object > Path menu in Illustrator before bringing these paths into Photoshop? They both have a lot of extraneous points. Be sure to click the ellipses (...) to bring up options for better control and read this Help file to understand how to use this feature without changing the shape of your artwork:
https://helpx.adobe.com/illustrator/using/simplify_paths.html
Jane
Copy link to clipboard
Copied
This script adds a path with two subpaths.
One contains 2000 points, the second 1500.
As you can see, everything works, while the DOM function throws an error.
try {
var pth = new Array();
var p0 = new Array();
var p1 = new Array();
for (var i = 0; i < 2000; i++)
{
p0[i] = new PathPointInfo();
p0[i].kind = PointKind.SMOOTHPOINT;
p0[i].anchor = [i,i];
p0[i].leftDirection = p0[i].anchor;
p0[i].rightDirection = p0[i].anchor;
}
for (var i = 0; i < 1500; i++)
{
p1[i] = new PathPointInfo();
p1[i].kind = PointKind.SMOOTHPOINT;
p1[i].anchor = [i+10,i];
p1[i].leftDirection = p1[i].anchor;
p1[i].rightDirection = p1[i].anchor;
}
pth[0] = new SubPathInfo();
pth[0].operation = ShapeOperation.SHAPEADD;
pth[0].closed = true;
pth[0].entireSubPath = p0;
pth[1] = new SubPathInfo();
pth[1].operation = ShapeOperation.SHAPEADD;
pth[1].closed = true;
pth[1].entireSubPath = p1;
//app.activeDocument.pathItems.add("Path", pth); // fail !!!
add_path("Path", pth) // ok !!
function add_path(name, sub_path_info)
{
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("path"), stringIDToTypeID("workPath"));
d.putReference(stringIDToTypeID("null"), r);
var list = new ActionList();
for (var i = 0; i < sub_path_info.length; i++)
{
var d1 = new ActionDescriptor();
switch (sub_path_info[i].operation)
{
case ShapeOperation.SHAPEADD: d1.putEnumerated(stringIDToTypeID("shapeOperation"), stringIDToTypeID("shapeOperation"), stringIDToTypeID("add")); break;
case ShapeOperation.SHAPEINTERSECT: d1.putEnumerated(stringIDToTypeID("shapeOperation"), stringIDToTypeID("shapeOperation"), stringIDToTypeID("intersect"));break;
case ShapeOperation.SHAPESUBTRACT: d1.putEnumerated(stringIDToTypeID("shapeOperation"), stringIDToTypeID("shapeOperation"), stringIDToTypeID("subtract")); break;
case ShapeOperation.SHAPEXOR: d1.putEnumerated(stringIDToTypeID("shapeOperation"), stringIDToTypeID("shapeOperation"), stringIDToTypeID("xor")); break;
}
var list1 = new ActionList();
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("closedSubpath"), sub_path_info[i].closed);
var list2 = new ActionList();
for (var n = 0; n < sub_path_info[i].entireSubPath.length; n++)
{
var d3 = new ActionDescriptor();
var d4 = new ActionDescriptor();
d4.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].anchor[0]);
d4.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].anchor[1]);
d3.putObject(stringIDToTypeID("anchor"), stringIDToTypeID("point"), d4);
var d4 = new ActionDescriptor();
d4.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].leftDirection[0]);
d4.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].leftDirection[1]);
d3.putObject(stringIDToTypeID("forward"), stringIDToTypeID("point"), d4);
var d4 = new ActionDescriptor();
d4.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].rightDirection[0]);
d4.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("distanceUnit"), sub_path_info[i].entireSubPath[n].rightDirection[1]);
d3.putObject(stringIDToTypeID("backward"), stringIDToTypeID("point"), d4);
d3.putBoolean(stringIDToTypeID("smooth"), sub_path_info[i].entireSubPath[n].kind==PointKind.SMOOTHPOINT);
list2.putObject(stringIDToTypeID("pathPoint"), d3);
d2.putList(stringIDToTypeID("points"), list2);
}
list1.putObject(stringIDToTypeID("subpathsList"), d2);
d1.putList(stringIDToTypeID("subpathListKey"), list1);
list.putObject(stringIDToTypeID("pathComponent"), d1);
}
d.putList(stringIDToTypeID("to"), list);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
// rename path
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("path"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putProperty(stringIDToTypeID("path"), stringIDToTypeID("workPath"));
d.putReference(stringIDToTypeID("from"), r1);
d.putString(stringIDToTypeID("name"), name);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
}
catch (e) { throw(e); }
}
} catch (e) { alert(e); }
Copy link to clipboard
Copied
I did not try this, but does adding the path fail when there's already one, same named?
Copy link to clipboard
Copied
It works !
thanks a lot for your response @r-bin !
can you know if there is a limit with this script ?
Have a good day !
Copy link to clipboard
Copied
There are always limits is there something beyond infinity IMO infinity is a figment of the human mind . Some Photoshop limits are awfully small like you can one have up to 53 Alpha channels. Where you can have 8,000 layer with layer mask, If I can have 8,000 layer mask why can I only have 53 Alpha mask.
Copy link to clipboard
Copied
I've been struggling with the same problem for about 5 hours now. Excellent! Thank you!
Copy link to clipboard
Copied
@*Romain* Is there any reason why you don't just copy the path from Illustrator then Paste as Layers into Photoshop (introduced with v23)? I've just tried it with 1018 point path and it worked fine.
I then transformed it and copied and paste in the other direction -i.e back to illustrator and the transformed path went back into Illustrator with all 1018 points.
Dave