Copy link to clipboard
Copied
Hello everyone,
I have a trapezoid and i want to turn it to rectangle by using script.
it is basically something like this:
BEFORE
AFTER
i need to find the width of the small side of the trapezoid, in our case it's 2043px:
and after the transform the other side will be 2043 as well:
any ideas?
Copy link to clipboard
Copied
Try it.
Straightens any quadrangle to rectangle.
eval("@JSXBIN@ES@2.0@MyBbyBnAHMgfbyBn0ABghBbyBn0ALOhCJhDnAEjzNjFjYjFjDjVjUjFiBjDjUjJjP"+
"jOBfRDEjzQjTjUjSjJjOjHiJiEiUjPiUjZjQjFiJiECfRBFeOjOjFjXiQjMjBjDjFjEiMjBjZjFjSff"+
"jzJjVjOjEjFjGjJjOjFjEDfXzCiOiPEfjzLiEjJjBjMjPjHiNjPjEjFjTFfffACzChBhdGXzEjLjJjO"+
"jEHfXzLjBjDjUjJjWjFiMjBjZjFjSIfXzOjBjDjUjJjWjFiEjPjDjVjNjFjOjUJfjzDjBjQjQKfXzLi"+
"TiNiBiSiUiPiCiKiFiDiULfjzJiMjBjZjFjSiLjJjOjEMfnnnJhFnASzFjMjBjZjFjSNAXIfXJfjKfn"+
"ftJhHnAEjzHjSjFjGjSjFjTjIOfnfJhInAEjzMjTjJjEjFifjEjJjTjUjPjSjUPfRCVNfAFdAffJhJn"+
"AEjOfnfJhKnAEjPfRCVNfAFdCffJhLnAEjOfnfJhMnAEjPfRCVNfAFdBffJhNnAEjOfnfJhOnAEjPfR"+
"CVNfAFdDffJhQnAEXzIjEjFjTjFjMjFjDjUQfXzJjTjFjMjFjDjUjJjPjORfXJfjKfnfABnzBjFSnby"+
"Bn0ACJhSnAEXQfXRfXJfjKfnfJyhSnABjzCjPjLTfncffABN40BiAABAzEjNjBjJjOUAhTMhWbyBn0A"+
"BghYbyBn0AMJhZnASzBjQVAEjzFiBjSjSjBjZWfntnftchdnAVzEjTjJjEjFXfHFRBFdAfRBFdBfRBF"+
"dCfRBFdDfRBnfFbiAn0AEJiAnABXzBhQYfVVfAEjzJjHjFjUifjQjPjJjOjUZfR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ChAViRfDVhJfQnnnnnnnffJ2iMBnASiXJChAViUfGViWfInnnffO2iSBby2iUBn0AB"+
"O2iUBb2iWBn0ACO2iWBJ2iWBnASzCjShQiZKAREViVfHViUfGViRfDViWfIfnffAhhHVgefPJ2iXBnA"+
"SiZKAREViSfFViUfGViRfDViWfIfnffO2iZBJ2iZBnASzCjOhQiaLAREARCXYfViZfKXgafViZfKfAR"+
"CXhVfViZfKXgafViZfKfARCXhVfViZfKXhWfViZfKfARCChdXYfViZfKViXfJnnXhWfViZfKffnffAh"+
"hHVgefPJ2iaBnASiaLAREARCChAXYfViZfKViXfJnnXgafViZfKfARCXhVfViZfKXgafViZfKfARCXh"+
"VfViZfKXhWfViZfKfARCXYfViZfKXhWfViZfKffnffAChLEXzDjBjCjTibfjhFfRBChAViSfFViGfBn"+
"nffEXibfjhFfRBChAViSfFViRfDnnffnnb2ieBn0ACO2ieBJ2ieBnASiZKAREViGfBViUfGViVfHViW"+
"fIfnffAhhHVgefPJ2ifBnASiZKAREViGfBViUfGViSfFViWfIfnffO2jBBJ2jBBnASiaLAREARCXYfV"+
"iZfKXgafViZfKfARCXhVfViZfKXgafViZfKfARCChdXhVfViZfKViXfJnnXhWfViZfKfARCXYfViZfK"+
"XhWfViZfKffnffAhhHVgefPJ2jCBnASiaLAREARCXYfViZfKXgafViZfKfARCChAXhVfViZfKViXfJn"+
"nXgafViZfKfARCXhVfViZfKXhWfViZfKfARCXYfViZfKXhWfViZfKffnffAhhHViYfOby2jHBn0ABO2"+
"jHBb2jJBn0ACO2jJBJ2jJBnASiZKAREViSfFViQfCViVfHViWfIfnffAhhHVgefPJ2jKBnASiZKAREV"+
"iSfFViQfCViVfHViUfGfnffO2jMBJ2jMBnASiaLAREARCXYfViZfKXgafViZfKfARCXhVfViZfKXgaf"+
"ViZfKfARCXhVfViZfKChdXhWfViZfKViXfJnnfARCXYfViZfKXhWfViZfKffnffAhhHVgefPJ2jNBnA"+
"SiaLAREARCXYfViZfKXgafViZfKfARCXhV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UjBjUjJj"+
"DjUjFjYjUjDfFeEiXjBjJjUffnfJLnABXzFjXjJjEjUjIjOfXzNjQjSjFjGjFjSjSjFjEiTjJjajFjP"+
"fXjMfVjBfyBndlAfJMnABXzHjKjVjTjUjJjGjZjQfXjMfVjBfyBneGjDjFjOjUjFjSfJOnAEXzEjTjI"+
"jPjXjRfVjBfyBnfJQnASTyBnctftOSJSnAEXzOjTjVjTjQjFjOjEiIjJjTjUjPjSjZjSfXJfjKfRCFe"+
"KiTjUjSjBjJjHjIjUjFjOFeGjNjBjJjOhIhJffAXzGjMjFjOjHjUjIjTfXzJjEjPjDjVjNjFjOjUjTj"+
"UfjKfnOUbWn0ACJWnAEjBfRDEjCfRBFeJjVjOjEjPiFjWjFjOjUffjDfXEfjFfffJXnAEXjSfXJfjKf"+
"RCFeEiVjOjEjPFeAffAhhHVTfyBnJganAEXzFjDjMjPjTjFjVfVjBfyBnfJgcnABXhNfXhOfjKfViPf"+
"yBnfADT4C0AiAiP40BiAjB4B0AiAADAgcByB");
Copy link to clipboard
Copied
r-bin interesting... it works for trapezoid but it failed with different shape.
What is the source of this script? Is it yours? Is there reason for obfuscation?
I have undeform script but for now, it works only with smart objects and affine transformations. Not trapezoids, perspective, etc.
I hope Tom Ruark could advise when he returns from vacation.
Copy link to clipboard
Copied
Shape should be a quadrangle. On what shapes does it fail?
The script works slowly and not very accurately because it itself tries to find the coordinates of the corners of the shape. If you set the coordinates manually, for example, with a vector mask, then the speed and accuracy will increase. The script uses a transform-distort method.
UPD.
Convert an arbitrarily deformed smart object back into a 100% percentage rectangle can be quite simple. It is enough to copy all the layers from the smart object back to the document itself and convert them to a smart object.
UPD2.
I found on which figures the script fails. Yes, alnorhythm is not perfect. Maybe I'll do something if I'm interested.
Copy link to clipboard
Copied
ad UPD) I have unsmart script too (in default settings reproduces deformation) but problem is when you are using layer comps or timeline. Because layerID is lost. And next problem is that after making it smart again you will create instance of something else. Content is not shared with not-unsmarted layers. So you need to replace content or relink to file in filesystem or to the file in cloud. And you also can't unsmart vector smart object (AI, SVG, PDF) and video layer. Or content might have indexed colors mode and parent document RGB mode or oposite.
Copy link to clipboard
Copied
I'll try to see what I can do for a smart object. But I do not really care. In CS6, it will not work anyway. And the version above to me also it is not necessary.
Copy link to clipboard
Copied
I found how to do unwarp for a smart object.
I think then I'll deal with transform and nonAffineTransform.
UPD.
I've written an alpha version of the script, which removes any distortions from the smart object.
If you want, you can check how it works.untransform.jsxbin - Google Drive
Note: If you put rulerUnits in percentages, then the script will not produce nonaffine untransform.
UPD2.
If you looked at the script, you might notice that sometimes a message is given that the final dimensions are not integers, but with a small, extremely small error.
I tried your script from the PS_magic_scripts package. It also often produces such a result. This means that the smart object is not completely like a non-deformable original. I already solved this problem in the new version. You can also dig in your own script. )
Copy link to clipboard
Copied
In short, I studied this issue for a long time and came to the conclusion that the reverse transformation of a smart object back into 100% state is useless.
To make sure of this, create the document 8000x4500x72.
Create a layer. Fill it with black.
Draw a few white lines in a thickness of a pixel.
Convert it to a smart object.
Duplicate the smart object.
On the top create Levels layer (0 1,0 2 -> 0 255).
Make a simple transformation for the top smart object (w = 22%, h = 33%, a = 20 °).
Call any script for undeformation.
Make translate (not move) for the layer in either direction.
You will see how the white lines are blurred. No result.
With the lower smart object (which is 100%), this does not happen.
I think that it is impossible to do this by any reverse transormation.
P.S. By the way, there is a similar script that removes the transformation, including distortion, of the smart object in PS CS6. But it is also not ideal in the general case.
Copy link to clipboard
Copied
r-bin interesting... it works for trapezoid but it failed with different shape.
What is the source of this script? Is it yours? Is there reason for obfuscation?
I have undeform script but for now, it works only with smart objects and affine transformations. Not trapezoids, perspective, etc.
I hope Tom Ruark could advise when he returns from vacation.
In continuation of the conversation. )
I'm here interested in parsing a PSD file.
While things are moving slowly. But I discovered an amazing thing.
This script returns the smart object to its original 100% state from any distortion.
The script is extremely simple. Does not specifically use file parsing. It is assumed that there is only one smart object in the file, the transformation can be any, but does not contain warp, the file is saved at least once on the disk.
If you are interested in this method, you can develop it.
var file = activeDocument.fullName;
activeDocument.save();
file.open("e");
file.encoding = "BINARY";
var len = file.length;
if (len > 100000) len = 100000;
var buff = file.read(len);
var n = buff.indexOf("8BIMSoLd");
if (n > 0)
{
var off = n+20;
var d = new ActionDescriptor();
d.fromStream(buff.substr(off))
var w = d.getObjectValue(stringIDToTypeID("size")).getDouble(stringIDToTypeID("width"));
var h = d.getObjectValue(stringIDToTypeID("size")).getDouble(stringIDToTypeID("height"));
var list = new ActionList()
list.putDouble(0);
list.putDouble(0);
list.putDouble(w);
list.putDouble(0);
list.putDouble(w);
list.putDouble(h);
list.putDouble(0);
list.putDouble(h);
d.putList(stringIDToTypeID("transform"), list);
d.putList(stringIDToTypeID("nonAffineTransform"), list);
file.seek(off, 0);
file.write(d.toStream());
file.close();
app.activeDocument.suspendHistory("TMP", "");
executeAction(stringIDToTypeID("revert"), undefined, DialogModes.NO);
runMenuItem(stringIDToTypeID("freeTransform"));
}
else
{
alert("No Smart Object found")
file.close();
}
upd.
works in CS6
Copy link to clipboard
Copied
r-bin That is smart. So you basically find actionDescriptor in binary form for smart object transformation and then you create regular descriptor from it, find four corners of smart object and you set them to its width and height also present in that descriptor then you convert it back to binary and rewrite original data. So after PSD reopen it should be ok.
Copy link to clipboard
Copied
I wrote a preliminary parser. It seems to work.
This script removes any transformation, including the warp from the smart object for the current layer.
Works for PSD (B) files. Tested in CS6.
Restores the smart object 100% (tested on very large sizes) in contrast to the scripts that are trying to do the reverse transformation.
Copy link to clipboard
Copied
In the script error. It moves the smart object not to the point [x0, y0] of the current object, but to [x0, x0]
🙂
Copy link to clipboard
Copied
r-bin it works very nice with trapezoid.
any chance the path i made in the following picture can help speed things up?
(btw this is how it works perfectly with the script)
Copy link to clipboard
Copied
OK. Try it. Create a path from four points. For a script, it's important that pathpoints are created in such a sequence.
It is also important that at the time the script was run, the path was active (highlighted).
At large angles, there may be bugs. I do not understand who, at me or at a photoshop?
eval("@JSXBIN@ES@2.0@MyBbyBnAFMhBbyBn0ABghDbyBn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JnHnASiDBEjzGiOjVjNjCjFjSiQfRBXzFjWjBjMjVjFiRfXhMfXzGjCjPjVjOjEjTiSfXIfjJfffn"+
"ftJnInASzBjUiTCEjiQfRBXiRfXhQfXiSfXIfjJfffnftJnJnASPDEjiQfRBXiRfXhTfXiSfXIfjJff"+
"fnftJnKnASzBjCiUEEjiQfRBXiRfXhRfXiSfXIfjJfffnftOnSbnUn0AFJnUnASzCjYhQiVFChXViAf"+
"QChaEXzDjUjBjOiWfjhcfRBViKfNffChXViBfRViTfCnnnnnnnffJnVnASzCjZhQiXGViTfCnffJnXn"+
"ASzCjYhRiYHCzBhLiZViAfQChaEXiWfjhcfRBViKfNffChXViUfEViBfRnnnnnnnffJnYnASzCjZhRi"+
"aIViUfEnffJnanASzDjPjGjGibJChXViVfFViYfHnnnffAhheVzEjWjFjSjUicfObnen0AFJnenASiV"+
"FViDfBnffJnfnASiXGCiZViBfRChaEXiWfjhcfRBViKfNffChXViAfQViDfBnnnnnnnffJ2BBnASiYH"+
"VPfDnffJ2CBnASiaIChXViBfRChaEXiWfjhcfRBViKfNffChXVPfDViAfQnnnnnnnffJ2EBnASibJCh"+
"XViXfGViafInnnffO2KBby2MBn0ABO2MBb2OBn0ACO2OBJ2OBnASzCjShQidKAREViYfHViXfGVPfDV"+
"iafIfnffAhheVhVfPJ2PBnASidKAREViVfFViXfGVPfDViafIfnffO2RBJ2RBnASzCjOhQieLAREARC"+
"XhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCCiZXhMfVidfKV"+
"ibfJnnXhRfVidfKffnffAhheVhVfPJ2SBnASieLAREARCChXXhMfVidfKVibfJnnXhQfVidfKfARCXh"+
"TfVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffAChJEXzDjBjCjT"+
"iffjhcfRBChXViVfFViDfBnnffEXiffjhcfRBChXViVfFVPfDnnffnnb2WBn0ACO2WBJ2WBnASidKAR"+
"EViDfBViXfGViYfHViafIfnffAhheVhVfPJ2XBnASidKAREViDfBViXfGViVfFViafIfnffO2ZBJ2ZB"+
"nASieLAREARCXhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCCiZXhTfVidfKVibfJnnXhRf"+
"VidfKfARCXhMfVidfKXhRfVidfKffnffAhheVhVfPJ2gaBnASieLAREARCXhMfVidfKXhQfVidfKfAR"+
"CChXXhTfVidfKVibfJnnXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffA"+
"hheVicfOby2gfBn0ABO2gfBb2hBBn0ACO2hBBJ2hBBnASidKAREViVfFViTfCViYfHViafIfnffAhhe"+
"VhVfPJ2hCBnASidKAREViVfFViTfCViYfHViXfGfnffO2hEBJ2hEBnASieLAREARCXhMfVidfKXhQfV"+
"idfKfARCXhTfVidfKXhQfVidfKfARCXhTfVidfKCiZXhRfVidfKVibfJnnfARCXhMfVidfKXhRfVidf"+
"KffnffAhheVhVfPJ2hFBnASieLAREARCXhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCXhT"+
"fVidfKXhRfVidfKfARCXhMfVidfKChXXhRfVidfKVibfJnnffnffAChJEXiffjhcfRBChXViXfGViUf"+
"EnnffEXiffjhcfRBChXViXfGViTfCnnffnnb2hJBn0ACO2hJBJ2hJBnASidKAREViVfFViafIViYfHV"+
"iUfEfnffAhheVhVfPJ2hKBnASidKAREViVfFViXfGViYfHViUfEfnffO2hMBJ2hMBnASieLAREARCXh"+
"MfVidfKXhQfVidfKfARCXhTfVidfKCiZXhQfVidfKVibfJnnfARCXhTfVidfKXhRfVidfKfARCXhMfV"+
"idfKXhRfVidfKffnffAhheVhVfPJ2hNBnASieLAREARCXhMfVidfKChXXhQfVidfKVibfJnnfARCXhT"+
"fVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffJ2hSBnAEjiJfRCV"+
"idfKViefLffJ2hUBnABXiMfXiNfjKf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LjDjMjPjTjFiCjVjUjUjPjOjLFcfzKjDjMjPjTjFiPjOiLjFjZjMFcfftnftJH"+
"nABXzHjNjBjSjHjJjOjTjNfVjFfyBAREFdAFdKFdAFdKfnfJInABXzLjPjSjJjFjOjUjBjUjJjPjOjO"+
"fVjFfyBneGjDjPjMjVjNjOfJJnABXzNjBjMjJjHjOiDjIjJjMjEjSjFjOjPfVjFfyBneGjDjFjOjUjF"+
"jSfJKnABXzDjUjYjUjQfVjFfyBEXzDjBjEjEjRfVjFfyBRDFeKjTjUjBjUjJjDjUjFjYjUjDfFeEiXj"+
"BjJjUffnfJLnABXzFjXjJjEjUjIjSfXzNjQjSjFjGjFjSjSjFjEiTjJjajFjTfXjQfVjFfyBndlAfJM"+
"nABXzHjKjVjTjUjJjGjZjUfXjQfVjFfyBneGjDjFjOjUjFjSfJOnAEXzEjTjIjPjXjVfVjFfyBnfJQn"+
"ASgcyBnctftJSnABXiMfXiNfjKfXiOfjiPfnfOUJUnAEXzOjTjVjTjQjFjOjEiIjJjTjUjPjSjZjWfX"+
"JfjKfRCFeKiTjUjSjBjJjHjIjUjFjOFeGjNjBjJjOhIhJffAXhIfXzJjEjPjDjVjNjFjOjUjTjXfjKf"+
"nOWbYn0ACJYnAEjBfRDEjCfRBFeJjVjOjEjPiFjWjFjOjUffjDfXEfjFfffJZnAEXjWfXJfjKfRCFeE"+
"iVjOjEjPFeAffAhheVgcfyBnJgcnAEXzFjDjMjPjTjFjYfVjFfyBnfJgenABXiMfXiNfjKfViLfyBnf"+
"ADgc4C0AiAiL40BiAjF4B0AiAADAhCByB");
Copy link to clipboard
Copied
ADD
Points do not have to be in the corners. That area which they designate will become a rectangle after transform.
Copy link to clipboard
Copied
I used r-bin's Straightens any quadrangle to rectangle script and i straightened a rectangle to the canvas (works perfect):
BEFORE
AFTER
I want to straighten a trapezoid in a way that it will fit up side of the layer to up side of the canvas, and down side of the layer to down side of the canvas automatically, just like that:
BEFORE
AFTER
this is where i got so far (after using r-bin's script):
if I use Free Transform > Perspective I can manually change it to:
BUT there is a difference in the location of X1 and Y1, X2 and Y2.
i made some calculations and i think my logic is right and it's just a matter of execution by script.
So let's say this is how my original trapezoid looked like:
X1 = 650
X2 = 2650
X2-X1 = 2000
Canvas Width = 4000
and here is how it should be:
X1 = 1000
X2 = 3000
X2-X1 = 2000
Canvas Width = 4000
This is how to get there:
Y1 should be = (4000-2650+650) /2 = 1000
in other words (Canvas Width - X2 + X1) * 0.5
Y2 should be = 4000-1000 = 3000
in other words Canvas Width -Y1
After I know where my Y1 and Y2 needs to be, there must be an automatic way to:
1. Distort top left corner to Y1
2. Distort top right corner to Y2.
Any kind of help will be appreciated
Copy link to clipboard
Copied
r-bin any ideas?
Copy link to clipboard
Copied
I already gave you similar scripts for alignment. Search.
You can use the script from my post # 6. After the quadrilateral becomes a rectangle, add an empty layer from above, link it with a smart object or select both at the same time and call perspective transform. After that, the empty layer can be deleted.
Copy link to clipboard
Copied
of course i remember the symmetry skew, that's the first thing i thought about, i still have problems combining between the two
Copy link to clipboard
Copied
any chance to bother you to combine the two?
this is the auto symmetry one:
and combine it with the jsxbin of this thread.
thanks anyway!
Copy link to clipboard
Copied
Mark as accurately as possible corners with four WorkPath points in the sequence as described in post # 6.
Run the script strai2.jsxbin - Google Drive
Copy link to clipboard
Copied
created a WorkPath, i'm getting this:
I wonder if it's possible to make it work without having to create a work path because the script straightens any quadrangle to rectangle did not require a work path, and the script Auto Symmetry Skew did not require a work path. a combination of the two can be pretty awesome
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It worked! that was awesome!
my process is becoming more and more automatic each day
thank you my friend
Copy link to clipboard
Copied
Hi r-bin,
Thank you for your great script. I see that it has fixed a lot of problems of many graphic designers here.
Unfortunaltely I cannot open the file as it doesn't exist anymore on Google Drive.
Is there a chance I can have the file too?
Thank you so much