Copy link to clipboard
Copied
Similar to the Align to Pixel Grid except for points not objects. Doesn't sound like it would be that difficult - simply rounding up the position to the nearest whole pixel.
Copy link to clipboard
Copied
blackmath wrote: Doesn't sound like it would be that difficult - simply rounding up the position to the nearest whole pixel.
You're right, it's not, so what do you have so far?
Copy link to clipboard
Copied
From a non-scripter's perspective I thought rounding up the position of anchor points to the nearest whole number would be quite straightforward. It sounds simple in principle, but I'm guessing the fact that there are no scripts out there that do such a thing is evidence to the contrary.
Copy link to clipboard
Copied
@ pixxxel what was the "diffArray" used for in your code? To compare before and after?
blackmath wrote:
... but I'm guessing the fact that there are no scripts out there ...
[^ So back to that point] I think it's more about the fact there is a lack of need for one, not the lack of ability to make one. 😉 I was gonna suggest earlier that it seems more of a workflow understanding issue (please don't take it wrong, not meant to offend) than a need for a script. You can find many articles about pixel perfect, pixel hinting, etc.. design in Illustrator.
Copy link to clipboard
Copied
W_J_T schrieb:
@ pixxxel what was the "diffArray" used for in your code? To compare before and after? …
Oh sorry. It's only a part from my another script that I forgotten to clean.
Copy link to clipboard
Copied
IMHO this seems to be no good idea!
blackmath schrieb:
… Doesn't sound like it would be that difficult - simply rounding up the position to the nearest whole pixel.
Yes. For one simple object like a rectangle (pointType: corner) this might be so. Perhaps with an ellipse this could be easy also.
But for a complex file with hundreds and thousands of paths? How much time do you have? And additional: Are there really paths only or more paths from appearance panel or effects or brushes and so on? With script elaborately or even impossible.
Furthermore:
What is if you have had paths with small dimensions like a vectorized font in your document? This can't be give you a good result - never!
Here an example with a 20pt letter c in Myriad Pro (red is original vectorized letter and black [in Modus difference = blue] the result after aligning)
But anyway - for the beginningyou can try something like this:
// pathPointsSnapToPixelGrid.jsx
// use it on your own risk
// required: an opened document with one pathItem
// regards pixxxelschubser
var aDoc = app.activeDocument;
var pP = aDoc.pathItems[0].pathPoints;
var diffArray = [];
var anArray = [];
var leftArray = [];
var rightArray = [];
for (i=pP.length-1; i >=0 ; i--) {
anArray = [Math.round(pP.anchor[0]), Math.round(pP.anchor[1])];
leftArray = [
pP.leftDirection[0] - (pP.anchor[0] - Math.round(pP.anchor[0])),
pP.leftDirection[1] - (pP.anchor[1] - Math.round(pP.anchor[1]))
];
rightArray = [
pP.rightDirection[0] - (pP.anchor[0] - Math.round(pP.anchor[0])),
pP.rightDirection[1] - (pP.anchor[1] - Math.round(pP.anchor[1]))
];
aDoc.pathItems[0].pathPoints.anchor = anArray;
aDoc.pathItems[0].pathPoints.leftDirection = leftArray;
aDoc.pathItems[0].pathPoints.rightDirection = rightArray;
}
Have fun and give a response please
Copy link to clipboard
Copied
Hi pixxxel schubser,
I was concerned with the same thing concerning distortion possibilities.
@ blackmath,
For better understanding, can you please explain further what your intent / need / use for this is? As well as provide us an example screen shot / or file of the type of typical things it will be used with.
Copy link to clipboard
Copied
I've been designing simple logos and ensuring that each anchor point is positioned on a pixel boundary. As soon as I scale up the logo the points no longer align to the pixel grid. I don't really understand how that's possible if it's a proportional increase. That's what led to this request.
Copy link to clipboard
Copied
simple maths
E.g. a rectangle with 4px × 5px will be scaled, say to 6px in x proportional increase. The result in y = 5px * factor1,5 = 7,5px
Copy link to clipboard
Copied
I'm incredibly stupid.
Copy link to clipboard
Copied
Better: lost in minds.
One question:
did you try the script snippet meantime?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now