Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Exit

- Home
- Illustrator
- Discussions
- Betreff: Retrieve the details of shear angle, hori...

- Betreff: Retrieve the details of shear angle, hori...

0

/t5/illustrator-discussions/retrieve-the-details-of-shear-angle-horizontal-scale-and-vertical-scale/td-p/12861335
Apr 05, 2022
Apr 05, 2022

Copy link to clipboard

Copied

Hiii everyone, I'm trying to retrieve the details of shear angle, horizontal scale and vertical scale Of the image in illustrator. Please help me to get the solution. Thank you.

TOPICS

Scripting

Community guidelines

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

Engaged
,
Apr 06, 2022
Apr 06, 2022

First question: Howâ€™s your math?

(Personally I forgot all mine decades ago, and even those who know geometry think Adobeâ€™s is weird, so caveat emptor, E&OE, etc.)

Anyway, welcome to the `matrix` property:

```
var image = app.activeDocument.placedItems[0]
var matrix = image.matrix
```

This will give you information on the transformation thatâ€™s currently applied to the imageâ€ . Everything after this will give you a headache.

Hereâ€™s a good overview:

...

4
Replies
4

/t5/illustrator-discussions/retrieve-the-details-of-shear-angle-horizontal-scale-and-vertical-scale/m-p/12861931#M317343
Apr 06, 2022
Apr 06, 2022

Copy link to clipboard

Copied

Please show the image.

Community guidelines

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

Abpujar
AUTHOR

Explorer
,

/t5/illustrator-discussions/retrieve-the-details-of-shear-angle-horizontal-scale-and-vertical-scale/m-p/12862210#M317360
Apr 06, 2022
Apr 06, 2022

Copy link to clipboard

Copied

Community guidelines

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

/t5/illustrator-discussions/retrieve-the-details-of-shear-angle-horizontal-scale-and-vertical-scale/m-p/12863318#M317456
Apr 06, 2022
Apr 06, 2022

Copy link to clipboard

Copied

First question: Howâ€™s your math?

(Personally I forgot all mine decades ago, and even those who know geometry think Adobeâ€™s is weird, so caveat emptor, E&OE, etc.)

Anyway, welcome to the `matrix` property:

```
var image = app.activeDocument.placedItems[0]
var matrix = image.matrix
```

This will give you information on the transformation thatâ€™s currently applied to the imageâ€ . Everything after this will give you a headache.

Hereâ€™s a good overview:

http://www.senocular.com/flash/tutorials/transformmatrix/

It talks about Flash but the principles are the same. To summarize, a *matrix* object has 4 properties describing how the image is transformed (plus an extra 2 that can be used to move it around which arenâ€™t relevant here):

mValueA:* x scale*

mValueB: *y skew*

mValueC: *x skew*

mValueD: *y scale*

Second question: for what purposes do you need this information?

e.g. To remove all transformations from an image:

```
var matrix = new Matrix()
matrix.mValueA = 1.0
matrix.mValueB = 0.0
matrix.mValueC = 0.0
matrix.mValueD = 1.0
image.matrix = matrix
```

Or to de-rotate the image while leaving its scale and skew unchanged:

```
var image = app.activeDocument.rasterItems[0]
var matrix = image.matrix
var angle = Math.atan2(matrix.mValueB, matrix.mValueA)
var angleInDegrees = angle / Math.PI * 180
image.rotate(-angleInDegrees)
```

Or to remove all skew (which also effectively removes the rotation, since one is the product of the other):

```
var matrix = image.matrix
matrix.mValueB = 0
matrix.mValueC = 0
image.matrix = matrix
```

And so on. If you want to copy the imageâ€™s transformation matrix to other objects, or apply further transforms, you can do that too. See the *Matrix* object in Illustratorâ€™s Scripting Reference, and the various matrix math commands on the *app* object.

OTOH, if you wish to know precisely what *x scale*, *y scale*, *x skew*, *y skew*, and *rotation* values the artist originally applied to the image, you will have to ask them that. Itâ€™s impossible to convert the 4 matrix values (A,B,C,D) back to those original 5â€¡, as any one transformation may be produced from any number of different combinations of scale, skew, and rotation numbers.

But anyway, thatâ€™s enough of that. Hope it helps, and pass the asprin.

--

â€ Use `rasterItems[n]` if the image is embedded instead of linked (`placedItems[n]`). Or just `pageItems[n]` if you donâ€™t care.

â€¡ Simultaneous equations are an implacable mistress. Youâ€™ll have to pin down values for 2 of the variables before you can calculate the rest.

Community guidelines

Abpujar
AUTHOR

Explorer
,

LATEST
/t5/illustrator-discussions/retrieve-the-details-of-shear-angle-horizontal-scale-and-vertical-scale/m-p/12866919#M317671
Apr 08, 2022
Apr 08, 2022

Copy link to clipboard

Copied

Thank you hhas01..

Community guidelines

Resources

Learning Resources for Illustrator

Crash on launch and known issues

Fonts and Typography in Illustrator

Copyright Â© 2024 Adobe. All rights reserved.