Make Rectangle from Trapezoid

Engaged ,
Sep 15, 2018 Sep 15, 2018

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

1.JPG

AFTER

4.JPG

i need to find the width of the small side of the trapezoid, in our case it's 2043px:

3.JPG

and after the transform the other side will be 2043 as well:

5.JPG

any ideas?

TOPICS
Actions and scripting

Views

5.0K

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Sep 26, 2018 Sep 26, 2018

Likes

translate

Translate

Translate
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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"+

"dCfRBFdDfRBnfFbiAn0AEJiAnABXzBhQYfVVfAEjzJjHjFjUifjQjPjJjOjUZfRCVNfGFdAffnfJiBn"+

"ABXzBhRgafVVfAEjZfRCVNfGFdDffnfJiCnASzDjWjFjSgbBncfffDiDnAzAgctbiGn0AEJiGnABXYf"+

"VVfAEjZfRCVNfGFdBffnfJiHnABXgafVVfAEjZfRCVNfGFdAffnfJiInASgbBnctffDiJnAgctbiMn0"+

"AEJiMnABXYfVVfAEjZfRCVNfGFdCffnfJiNnABXgafVVfAEjZfRCVNfGFdBffnfJiOnASgbBncfffDi"+

"PnAgctbiSn0AEJiSnABXYfVVfAEjZfRCVNfGFdDffnfJiTnABXgafVVfAEjZfRCVNfGFdCffnfJiUnA"+

"SgbBnctffDiVnAgctbyiYn0ABZiYnAnJibnASzDjBjOjHgdCndAftJicnASzDjJjOjWgeDncfftJien"+

"ASzBjXgfECzBhNhAXYfXYfVVfAXYfXgafVVfAnnnftJifnASzBjIhBFChAXgafXYfVVfAXgafXgafVV"+

"fAnnnftOjBbyjDn0ABOjDJjDnASgdCCzBhPhCCzBhKhDEXzEjBjUjBjOhEfjzEiNjBjUjIhFfRBChCV"+

"gffEVhBfFnnffnndlUXzCiQiJhGfjhFfnnnffACGVhBfFnndAnAhzBhBhHVgbfBbyjHn0ABOjHJjHnA"+

"SgdCChCChDhzBhNhIEXhEfjhFfRBChCVhBfFVgffEnnffnndlUXhGfjhFfnnnffACGVgffEnndAnOjK"+

"bjMn0ACJjMnAEXQfXRfXJfjKfnfZjNnAFctAhhHVgdfCnOjQbyjSn0ABOjSbjUn0ADJjUnASgeDnctf"+

"fJjWnABjzBjYhJfXYfXgafVVfAnfJjXnABjzBjZhKfXgafXgafVVfAnfACzBhchLXYfXgafVVfAXYfX"+

"YfVVfAnnbjbn0ACJjbnABjhJfXYfXYfVVfAnfJjcnABjhKfXgafXYfVVfAnfAhhHVgbfBbykBn0ABOk"+

"BbkDn0ACJkDnABjhJfXYfXgafVVfAnfJkEnABjhKfXgafXgafVVfAnfAChLXgafXgafVVfAXgafXYfV"+

"VfAnnbkIn0ADJkInASgeDnctffJkKnABjhJfXYfXYfVVfAnfJkLnABjhKfXgafXYfVVfAnfJkPnAEXQ"+

"fXRfXJfjKfnfJkRnAEjzHjEjJjTjUjPjSjUhMfRGVNfGVgdfCVgbfBVgefDjhJfjhKfffZkTnAFctAB"+

"nSnbyBn0ABfkVnAjSfAIhB4F0AiAgf4E0AiAV40BiAN40BhAX4B0AhAgb4B0AiAgd4C0AiAge4D0AiA"+

"CGAPAkWMkZbyBn0ABgkbbyBn0ALJkcnABXzKjSjVjMjFjSiVjOjJjUjThNfXzLjQjSjFjGjFjSjFjOj"+

"DjFjThOfjKfXzGiQiJiYiFiMiThPfjzFiVjOjJjUjThQfnfJkenASzBjChRAXzGjCjPjVjOjEjThSfV"+

"NfKnftJlKnASgfDEjzGiOjVjNjCjFjShTfRBChAXzFjWjBjMjVjFhUfXzBhShVfVhRfAXhUfXYfVhRf"+

"AnnffnftJlLnAShBEEjhTfRBChAXhUfXzBhThWfVhRfAXhUfXgafVhRfAnnffnftOlNblPn0AFJlPnA"+

"ShJBEjhTfRBXhUfXYfVhRfAffnffJlQnAShKCEjhTfRBXhUfXgafVhRfAffnffJlSnASzEjTjUjFjQh"+

"XFVgffDnffJlUnASzGjTjJjHjOifjYhYGndBffJlVnASzGjTjJjHjOifjZhZHndBffACzChdhdhaVzF"+

"jQjPjJjOjUhbfLnndAnOlYblan0AFJlanAShJBEjhTfRBXhUfXhVfVhRfAffnffJlbnAShKCEjhTfRB"+

"XhUfXgafVhRfAffnffJldnAShXFVgffDnffJlfnAShYGndyBffJmAnAShZHndBffAChaVhbfLnndBnO"+

"mDbmFn0AFJmFnAShJBEjhTfRBXhUfXhVfVhRfAffnffJmGnAShKCEjhTfRBXhUfXhWfVhRfAffnffJm"+

"InAShXFVgffDnffJmKnAShYGndyBffJmLnAShZHndyBffAChaVhbfLnndCnOmObmQn0AHJmQnAShJBE"+

"jhTfRBXhUfXYfVhRfAffnffJmRnAShKCEjhTfRBXhUfXhWfVhRfAffnffJmTnASgfDEjhTfRBChAXhU"+

"fXhVfVhRfAXhUfXYfVhRfAnnffnffJmUnAShBEEjhTfRBChAXhUfXhWfVhRfAXhUfXgafVhRfAnnffn"+

"ffJmWnAShXFVgffDnffJmYnAShYGndBffJmZnAShZHndyBffAChaVhbfLnndDnJmdnASzBjJhcIndAf"+

"tlmfbnBn0AHJnBnAShXFChCVhXfFnndKnffOnDJnDnAShXFndBffAChLVhXfFnndBnKnFbnHn0AEJnH"+

"nASVJARDARCVhJfBVhKfCfARCCzBhLhdVhJfBChDVhcfIVhYfGnnnnVhKfCfARCVhJfBChdVhKfCChD"+

"VhcfIVhZfHnnnnffnftJnJnAEjzUjTjFjMjFjDjUjJjPjOifjGjSjPjNifjMjBjZjFjShefnfJnKnAE"+

"XzGjTjFjMjFjDjUhffXRfXJfjKfRCVVfJXzJiJiOiUiFiSiTiFiDiUiAfjzNiTjFjMjFjDjUjJjPjOi"+

"UjZjQjFiBfffOnMDnMnAgctAEjzNjIjBjTifjTjFjMjFjDjUjJjPjOiCfnfnAnChLVhcfIVgffDnnSh"+

"cIChdnVhXfFnnntfOnPbnRn0ACOnRbnTn0ACJnTnAShRAXhSfXRfXJfjKfnftZnVnAARCChCEjhTfRB"+

"ChdXhUfXYfVhRfAXhUfXhVfVhRfAnnffnndCChCEjhTfRBChdXhUfXgafVhRfAXhUfXhWfVhRfAnnff"+

"nndCfAEjiCfnfJnXnAjzGjOjFjUjVjSjOiDfJnXnAFbAChaVhXfFnndBnJnanAShcIChAnVhXfFnnnt"+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fNffCh"+

"AVhRfEVhKfRnnnnnnnffJ2iABnASzCjZhRiWIVhRfEnffJ2iCBnASzDjPjGjGiXJChAViSfFViVfHnn"+

"nffAhhHVzEjWjFjSjUiYfOb2iGBn0AFJ2iGBnASiSFViGfBnffJ2iHBnASiUGChdVhKfRChDEXiTfjh"+

"FfRBViOfNffChAVhJfQViGfBnnnnnnnffJ2iJBnASiVHViRfDnffJ2iKBnASiWIChAVhKfRChDEXiTf"+

"jhFfRBViOfNffChAViRfDVhJfQnnnnnnnffJ2iMBnASiXJChAViUfGViWfInnnffO2iSBby2iUBn0AB"+

"O2iUBb2iWBn0ACO2iWBJ2iWBnASzCjShQiZKAREViVfHViUfGViRfDViWfIfnffAhhHVgefPJ2iXBnA"+

"SiZKAREViSfFViUfGViRfDViWfIfnffO2iZBJ2iZBnASzCjOhQiaLAREARCXYfViZfKXgafViZfKfAR"+

"CXhVfViZfKXgafViZfKfARCXhVfViZfKXhWfViZfKfARCChdXYfViZfKViXfJnnXhWfViZfKffnffAh"+

"hHVgefPJ2iaBnASiaLAREARCChAXYfViZfKViXfJnnXgafViZfKfARCXhVfViZfKXgafViZfKfARCXh"+

"VfViZfKXhWfViZfKfARCXYfViZfKXhWfViZfKffnffAChLEXzDjBjCjTibfjhFfRBChAViSfFViGfBn"+

"nffEXibfjhFfRBChAViSfFViRfDnnffnnb2ieBn0ACO2ieBJ2ieBnASiZKAREViGfBViUfGViVfHViW"+

"fIfnffAhhHVgefPJ2ifBnASiZKAREViGfBViUfGViSfFViWfIfnffO2jBBJ2jBBnASiaLAREARCXYfV"+

"iZfKXgafViZfKfARCXhVfViZfKXgafViZfKfARCChdXhVfViZfKViXfJnnXhWfViZfKfARCXYfViZfK"+

"XhWfViZfKffnffAhhHVgefPJ2jCBnASiaLAREARCXYfViZfKXgafViZfKfARCChAXhVfViZfKViXfJn"+

"nXgafViZfKfARCXhVfViZfKXhWfViZfKfARCXYfViZfKXhWfViZfKffnffAhhHViYfOby2jHBn0ABO2"+

"jHBb2jJBn0ACO2jJBJ2jJBnASiZKAREViSfFViQfCViVfHViWfIfnffAhhHVgefPJ2jKBnASiZKAREV"+

"iSfFViQfCViVfHViUfGfnffO2jMBJ2jMBnASiaLAREARCXYfViZfKXgafViZfKfARCXhVfViZfKXgaf"+

"ViZfKfARCXhVfViZfKChdXhWfViZfKViXfJnnfARCXYfViZfKXhWfViZfKffnffAhhHVgefPJ2jNBnA"+

"SiaLAREARCXYfViZfKXgafViZfKfARCXhVfViZfKXgafViZfKfARCXhVfViZfKXhWfViZfKfARCXYfV"+

"iZfKChAXhWfViZfKViXfJnnffnffAChLEXibfjhFfRBChAViUfGVhRfEnnffEXibfjhFfRBChAViUfG"+

"ViQfCnnffnnb2jRBn0ACO2jRBJ2jRBnASiZKAREViSfFViWfIViVfHVhRfEfnffAhhHVgefPJ2jSBnA"+

"SiZKAREViSfFViUfGViVfHVhRfEfnffO2jUBJ2jUBnASiaLAREARCXYfViZfKXgafViZfKfARCXhVfV"+

"iZfKChdXgafViZfKViXfJnnfARCXhVfViZfKXhWfViZfKfARCXYfViZfKXhWfViZfKffnffAhhHVgef"+

"PJ2jVBnASiaLAREARCXYfViZfKChAXgafViZfKViXfJnnfARCXhVfViZfKXgafViZfKfARCXhVfViZf"+

"KXhWfViZfKfARCXYfViZfKXhWfViZfKffnffJ2jaBnAEjiNfRCViZfKViafLffJ2jcBnABXhNfXhOfj"+

"KfViPfAnfABnSnbyBn0ABf2jeBnAjSfAShJ4E0AhAhK4F0AhAiY4C0AhAiR4D0AiAiS4F0AiAiQ4C0A"+

"iAiU4G0AiAiV4H0AiAiW4I0AiAiZ4K0AiAia4L0AiAiX4J0AiAiG4B0AiAiP40BiAN40BhAiO4B0AhA"+

"ge4D0AhAhR4E0AiAGMAhMA2jfBM2kCBbyBn0ABg2kEBbyBn0AIJ2kGBnASiRAEjzPiBjDjUjJjPjOiS"+

"jFjGjFjSjFjOjDjFicfntnftJ2kHBnAEXzLjQjVjUiQjSjPjQjFjSjUj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fzKjDjMjPjTjFiPjO"+

"iLjFjZjIFcfftnftJHnABXzHjNjBjSjHjJjOjTjJfVjBfyBAREFdAFdKFdAFdKfnfJInABXzLjPjSjJ"+

"jFjOjUjBjUjJjPjOjKfVjBfyBneGjDjPjMjVjNjOfJJnABXzNjBjMjJjHjOiDjIjJjMjEjSjFjOjLfV"+

"jBfyBneGjDjFjOjUjFjSfJKnABXzDjUjYjUjMfVjBfyBEXzDjBjEjEjNfVjBfyBRDFeKjTjUjBjUjJj"+

"DjUjFjYjUjDfFeEiXjBjJjUffnfJLnABXzFjXjJjEjUjIjOfXzNjQjSjFjGjFjSjSjFjEiTjJjajFjP"+

"fXjMfVjBfyBndlAfJMnABXzHjKjVjTjUjJjGjZjQfXjMfVjBfyBneGjDjFjOjUjFjSfJOnAEXzEjTjI"+

"jPjXjRfVjBfyBnfJQnASTyBnctftOSJSnAEXzOjTjVjTjQjFjOjEiIjJjTjUjPjSjZjSfXJfjKfRCFe"+

"KiTjUjSjBjJjHjIjUjFjOFeGjNjBjJjOhIhJffAXzGjMjFjOjHjUjIjTfXzJjEjPjDjVjNjFjOjUjTj"+

"UfjKfnOUbWn0ACJWnAEjBfRDEjCfRBFeJjVjOjEjPiFjWjFjOjUffjDfXEfjFfffJXnAEXjSfXJfjKf"+

"RCFeEiVjOjEjPFeAffAhhHVTfyBnJganAEXzFjDjMjPjTjFjVfVjBfyBnfJgcnABXhNfXhOfjKfViPf"+

"yBnfADT4C0AiAiP40BiAjB4B0AiAADAgcByB");

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 15, 2018 Sep 15, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 15, 2018 Sep 15, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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. )

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 21, 2018 Sep 21, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 10, 2018 Nov 10, 2018

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jarda+Bereza 

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 10, 2018 Nov 10, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 13, 2018 Nov 13, 2018

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.

smart_untransform.jsxbin - Google Drive

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 13, 2018 Nov 13, 2018

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]

🙂

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 15, 2018 Sep 15, 2018

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?

a.JPG

(btw this is how it works perfectly with the script)

DSC_0726 clean.jpg

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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.

Untitled-2.png

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@MyBbyBnAFMhBbyBn0ABghDbyBn0ATOhEJhFnAEjzNjFjYjFjDjVjUjFiBjDjUjJjP"+

"jOBfRDEjzQjTjUjSjJjOjHiJiEiUjPiUjZjQjFiJiECfRBFeOjOjFjXiQjMjBjDjFjEiMjBjZjFjSff"+

"jzJjVjOjEjFjGjJjOjFjEDfXzCiOiPEfjzLiEjJjBjMjPjHiNjPjEjFjTFfffACzChBhdGXzEjLjJjO"+

"jEHfXzLjBjDjUjJjWjFiMjBjZjFjSIfXzOjBjDjUjJjWjFiEjPjDjVjNjFjOjUJfjzDjBjQjQKfXzLi"+

"TiNiBiSiUiPiCiKiFiDiULfjzJiMjBjZjFjSiLjJjOjEMfnnnJhHnASzBjENAEjzQiBjDjUjJjPjOiE"+

"jFjTjDjSjJjQjUjPjSOfntnftJhInASzBjSPBEjzPiBjDjUjJjPjOiSjFjGjFjSjFjOjDjFQfntnftJ"+

"hJnAEXzIjQjVjUiDjMjBjTjTRfVPfBRBEjCfRBFeE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ffChXViAfQViDfBnnnnnnnffJ2BBnASiYH"+

"VPfDnffJ2CBnASiaIChXViBfRChaEXiWfjhcfRBViKfNffChXVPfDViAfQnnnnnnnffJ2EBnASibJCh"+

"XViXfGViafInnnffO2KBby2MBn0ABO2MBb2OBn0ACO2OBJ2OBnASzCjShQidKAREViYfHViXfGVPfDV"+

"iafIfnffAhheVhVfPJ2PBnASidKAREViVfFViXfGVPfDViafIfnffO2RBJ2RBnASzCjOhQieLAREARC"+

"XhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCCiZXhMfVidfKV"+

"ibfJnnXhRfVidfKffnffAhheVhVfPJ2SBnASieLAREARCChXXhMfVidfKVibfJnnXhQfVidfKfARCXh"+

"TfVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffAChJEXzDjBjCjT"+

"iffjhcfRBChXViVfFViDfBnnffEXiffjhcfRBChXViVfFVPfDnnffnnb2WBn0ACO2WBJ2WBnASidKAR"+

"EViDfBViXfGViYfHViafIfnffAhheVhVfPJ2XBnASidKAREViDfBViXfGViVfFViafIfnffO2ZBJ2ZB"+

"nASieLAREARCXhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCCiZXhTfVidfKVibfJnnXhRf"+

"VidfKfARCXhMfVidfKXhRfVidfKffnffAhheVhVfPJ2gaBnASieLAREARCXhMfVidfKXhQfVidfKfAR"+

"CChXXhTfVidfKVibfJnnXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffA"+

"hheVicfOby2gfBn0ABO2gfBb2hBBn0ACO2hBBJ2hBBnASidKAREViVfFViTfCViYfHViafIfnffAhhe"+

"VhVfPJ2hCBnASidKAREViVfFViTfCViYfHViXfGfnffO2hEBJ2hEBnASieLAREARCXhMfVidfKXhQfV"+

"idfKfARCXhTfVidfKXhQfVidfKfARCXhTfVidfKCiZXhRfVidfKVibfJnnfARCXhMfVidfKXhRfVidf"+

"KffnffAhheVhVfPJ2hFBnASieLAREARCXhMfVidfKXhQfVidfKfARCXhTfVidfKXhQfVidfKfARCXhT"+

"fVidfKXhRfVidfKfARCXhMfVidfKChXXhRfVidfKVibfJnnffnffAChJEXiffjhcfRBChXViXfGViUf"+

"EnnffEXiffjhcfRBChXViXfGViTfCnnffnnb2hJBn0ACO2hJBJ2hJBnASidKAREViVfFViafIViYfHV"+

"iUfEfnffAhheVhVfPJ2hKBnASidKAREViVfFViXfGViYfHViUfEfnffO2hMBJ2hMBnASieLAREARCXh"+

"MfVidfKXhQfVidfKfARCXhTfVidfKCiZXhQfVidfKVibfJnnfARCXhTfVidfKXhRfVidfKfARCXhMfV"+

"idfKXhRfVidfKffnffAhheVhVfPJ2hNBnASieLAREARCXhMfVidfKChXXhQfVidfKVibfJnnfARCXhT"+

"fVidfKXhQfVidfKfARCXhTfVidfKXhRfVidfKfARCXhMfVidfKXhRfVidfKffnffJ2hSBnAEjiJfRCV"+

"idfKViefLffJ2hUBnABXiMfXiNfjKfViLfAnfABngbnbyBn0ABf2hWBnAjgbfAShV4D0AhAiA4E0AhA"+

"ic4C0AhAiB4F0AhAiV4F0AiAiX4G0AiAiY4H0AiAiT4C0AiAia4I0AiAid4K0AiAie4L0AiAib4J0Ai"+

"AiD4B0AiAiL40BiAP4D0AiAW40BhAiK4B0AhAiU4E0AiAGMAiCA2hXBM2haBbyBn0ABg2hcBbyBn0AH"+

"J2hdBnASNAEjOfntnftJ2heBnASPBEjQfntnftJ2hfBnAEXUfVPfBRDEjCfRBFeEjQjBjUjIffEjCfR"+

"BFeEjQjBjUjIffEjCfRBFeKjWjFjDjUjPjSiNjBjTjLffffO2iBBJ2iBBnAEXUfVPfBRDEjCfRBFeFj"+

"MjBjZjFjSffEjCfRBFeHjPjSjEjJjOjBjMffEjCfRBFeKjUjBjSjHjFjUiFjOjVjNffffAUzCjcjcjA"+

"ChFVzCjJjEjBfCjDfnnChFVjBfCnnbnnO2iCBJ2i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jKfXiOfjiPfnfOUJUnAEXzOjTjVjTjQjFjOjEiIjJjTjUjPjSjZjWfX"+

"JfjKfRCFeKiTjUjSjBjJjHjIjUjFjOFeGjNjBjJjOhIhJffAXhIfXzJjEjPjDjVjNjFjOjUjTjXfjKf"+

"nOWbYn0ACJYnAEjBfRDEjCfRBFeJjVjOjEjPiFjWjFjOjUffjDfXEfjFfffJZnAEXjWfXJfjKfRCFeE"+

"iVjOjEjPFeAffAhheVgcfyBnJgcnAEXzFjDjMjPjTjFjYfVjFfyBnfJgenABXiMfXiNfjKfViLfyBnf"+

"ADgc4C0AiAiL40BiAjF4B0AiAADAhCByB");

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 15, 2018 Sep 15, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 19, 2018 Sep 19, 2018

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

before.JPG

AFTER

after.JPG

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

trapezoid-before.jpg

AFTER

trapezoid-after.jpg

this is where i got so far (after using r-bin's script):

ts1a.jpg

if I use Free Transform > Perspective I can manually change it to:

ts1b.jpg

BUT there is a difference in the location of X1 and Y1, X2 and Y2.

ts1c.jpg

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

was.jpg

and here is how it should be:

X1 = 1000

X2 = 3000

X2-X1 = 2000

Canvas Width = 4000

should be.JPG

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.

how to get there.jpg

Any kind of help will be appreciated

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 22, 2018 Sep 22, 2018

Copy link to clipboard

Copied

r-bin​ any ideas?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 22, 2018 Sep 22, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 22, 2018 Sep 22, 2018

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

any chance to bother you to combine the two?

this is the auto symmetry one:

  1. app.activeDocument.suspendHistory("Skew","skew_straighten_layer()");   
  2.    
  3. function skew_straighten_layer()   
  4.     {   
  5.     try {    
  6.         app.preferences.rulerUnits = Units.PIXELS;   
  7.  
  8.         var doc = app.activeDocument;   
  9.         var layer = app.activeDocument.activeLayer;   
  10.  
  11.         selection_from_layer();   
  12.  
  13.         var dh = Number(layer.bounds[3].value - layer.bounds[1].value)*0.01; 
  14.    
  15.         select_single_line(Number(layer.bounds[1].value) + dh, true, stringIDToTypeID("intersectWith"));   
  16.  
  17.         var x0 = Number(doc.selection.bounds[2].value + doc.selection.bounds[0].value)/2; 
  18.         var y0 = Number(doc.selection.bounds[3].value); 
  19.  
  20.         selection_from_layer();   
  21.  
  22.         select_single_line(Number(layer.bounds[3].value) - dh, true, stringIDToTypeID("intersectWith"));   
  23.  
  24.         var x1 = Number(doc.selection.bounds[2].value + doc.selection.bounds[0].value)/2; 
  25.         var y1 = Number(doc.selection.bounds[3].value); 
  26.  
  27.         doc.selection.deselect();     
  28.  
  29.         var w = x1 - x0;   
  30.         var h = y1 - y0;   
  31.    
  32.         var angle;   
  33.         if (h != 0)  
  34.             { 
  35.             angle = Math.atan(w/h) * 180.0 / Math.PI;   
  36.  
  37.             skew(layer, -angle,0, x1, y1); 
  38.             } 
  39.         }   
  40.     catch (e) { alert(e) }   
  41.     }   
  42.    
  43. function select_single_line(x, h, mode)   
  44.     {   
  45.     try   
  46.         {   
  47.         if (mode == undefined) mode = stringIDToTypeID("set");   
  48.    
  49.         var r = new ActionReference();   
  50.         r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));   
  51.    
  52.         var d = new ActionDescriptor();   
  53.         d.putReference(stringIDToTypeID("target"), r);   
  54.    
  55.         var d1 = new ActionDescriptor();   
  56.         d1.putUnitDouble(stringIDToTypeID(h?"top":"left"), stringIDToTypeID("pixelsUnit"), x);   
  57.    
  58.         d.putObject(stringIDToTypeID("to"), stringIDToTypeID(h?"singleRow":"singleColumn"), d1);   
  59.    
  60.         executeAction(mode, d, DialogModes.NO);   
  61.         }   
  62.     catch (e) { throw(e); }   
  63.     }   
  64.    
  65. function selection_from_layer()   
  66.     {   
  67.     try   
  68.         {   
  69.         var r = new ActionReference();   
  70.         r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));   
  71.    
  72.         var d = new ActionDescriptor();   
  73.         d.putReference(stringIDToTypeID("target"), r);   
  74.    
  75.         var r = new ActionReference();   
  76.         r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("transparencyEnum"));   
  77.         d.putReference(stringIDToTypeID("to"), r);   
  78.    
  79.         executeAction(stringIDToTypeID("set"), d, DialogModes.NO);   
  80.         }   
  81.     catch (e) { throw(e); }   
  82.     }   
  83.  
  84. function skew(layer, h,v, x, y) 
  85.     { 
  86.     try 
  87.         { 
  88.         app.activeDocument.activeLayer = layer; 
  89.  
  90.         var d1 = new ActionDescriptor(); 
  91.         var d2 = new ActionDescriptor(); 
  92.         var d3 = new ActionDescriptor(); 
  93.         var d4 = new ActionDescriptor(); 
  94.         var r1 = new ActionReference(); 
  95.  
  96.         r1.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) ); 
  97.  
  98.         d1.putReference( charIDToTypeID( "null" ), r1 ); 
  99.  
  100.         d1.putEnumerated( charIDToTypeID( "FTcs" ), charIDToTypeID( "QCSt" ), charIDToTypeID( "Qcsi" ) ); 
  101.  
  102.         if (x != undefined &&  y != undefined) 
  103.             {    
  104.             d2.putUnitDouble( charIDToTypeID( "Hrzn" ), charIDToTypeID( "#Pxl" ), x ); 
  105.             d2.putUnitDouble( charIDToTypeID( "Vrtc" ), charIDToTypeID( "#Pxl" ), y ); 
  106.             d1.putObject( charIDToTypeID( "Pstn" ), charIDToTypeID( "Pnt " ), d2 ); 
  107.             } 
  108.  
  109.         d4.putUnitDouble( charIDToTypeID( "Hrzn" ), charIDToTypeID( "#Ang" ), h ); 
  110.         d4.putUnitDouble( charIDToTypeID( "Vrtc" ), charIDToTypeID( "#Ang" ), v ); 
  111.  
  112.         d1.putObject( charIDToTypeID( "Skew" ), charIDToTypeID( "Pnt " ), d4 ); 
  113.  
  114.         executeAction( charIDToTypeID( "Trnf" ), d1, DialogModes.NO ); 
  115.         } 
  116.     catch (e) { throw(e); }   
  117.     } 

and combine it with the jsxbin of this thread.

thanks anyway!

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 23, 2018 Sep 23, 2018

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 25, 2018 Sep 25, 2018

Copy link to clipboard

Copied

created a WorkPath, i'm getting this:

null.JPG

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

It worked! that was awesome!

my process is becoming more and more automatic each day

thank you my friend

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2021 Mar 29, 2021

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines