# How to get SmartObject transform properties?

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218>\
**Category:** UXP Plugin API\
**Tags:** uxp, javascript\
**Created:** [December 5, 2023, 6:24pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218 "2023-12-05T18:24:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![photonic](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/photonic/32/2513_2.png) [@photonic](https://forums.creativeclouddeveloper.com/u/photonic)\
**Post date:** [December 5, 2023, 6:24pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/1 "2023-12-05T18:24:53Z")

</div>

SmartObjects have an option to “Convert to Layers” which is amazing, but if the SmartObject was transformed ( Scaled, moved around ) it will give you a message that the transform applied on the Smart Object will not be retained:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/f/f871042c984bacb884371a5c215c63c0bded4f89.png)

Is it possible to read this transformation of the Smart Object? I have a plugin that when It converts to layers it would need to retain the transformation. Any ideas how I could hack this behaviour?

Bests,

---

<div class="post-metadata">

**Author:** ![dotproduct](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dotproduct](https://forums.creativeclouddeveloper.com/u/dotproduct)\
**Post date:** [December 5, 2023, 6:34pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/2 "2023-12-05T18:34:36Z")

</div>

You can access smart object transform data via getting the ‘smartObjectMore’ data through batchPlay. Check out this topic: [Access SmartObject transform properties?](http://forums.creativeclouddeveloper.com/t/access-smartobject-transform-properties/5349/1)

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [December 5, 2023, 6:45pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/3 "2023-12-05T18:45:51Z")

</div>

Years ago I wrote ExtendScript and it has the option to do that. I take layer comps, transparency, and masks into consideration as well as scaling layer effects. Layer effects can be scaled only proportionally meaning 1:1 ratio in width and height. Also it will not change smart filters. [https://www.mightyplugins.cc/magic-scripts](https://www.mightyplugins.cc/magic-scripts)

---

<div class="post-metadata">

**Author:** ![photonic](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/photonic/32/2513_2.png) [@photonic](https://forums.creativeclouddeveloper.com/u/photonic)\
**Post date:** [December 6, 2023, 12:22am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/4 "2023-12-06T00:22:18Z")

</div>

I remember really well this script, I used to use it when I started to learn to program it helped me a lot to understand fundamentals! And then Adobe liked it so much that included that feature within PS! Seems the solution from @dotproduct did the job I was looking for!

---

<div class="post-metadata">

**Author:** ![photonic](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/photonic/32/2513_2.png) [@photonic](https://forums.creativeclouddeveloper.com/u/photonic)\
**Post date:** [December 6, 2023, 12:23am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/5 "2023-12-06T00:23:59Z")

</div>

Thank you very much man, that post helped me to find the solution I was looking for, I also created a function to get the scale from points, I’m adding that to that post in case someone finds it helpful!:

```auto
   function getScaleFromPoints(points, fullSize) {
        const A = points.upperLeft;
        const B = points.upperRight;
        const C = points.lowerLeft;

        const w = distance([A.x, A.y], [B.x, B.y]);
        const h = distance([A.x, A.y], [C.x, C.y]);

        const fullWidth = fullSize.width;
        const fullHeight = fullSize.height;

        const wP = (w * 100) / fullWidth;
        const hP = (h * 100) / fullHeight;

        return {
          width: wP,
          height: hP
        }

        function distance(a, b) {
          var AB = [b[0] - a[0], b[1] - a[1]];
          return Math.sqrt(AB[0] * AB[0] + AB[1] * AB[1]);
        }
      }

```

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [December 6, 2023, 12:54am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/6 "2023-12-06T00:54:28Z")

</div>

If you use rectangular to quadrilateral transformation… you don’t need to calculate scale. Instead, you will just define the corner coordinates of the target transformation.

---

<div class="post-metadata">

**Author:** ![photonic](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/photonic/32/2513_2.png) [@photonic](https://forums.creativeclouddeveloper.com/u/photonic)\
**Post date:** [December 6, 2023, 1:49am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-smartobject-transform-properties/7218/7 "2023-12-06T01:49:07Z")

</div>

I don’t know how to do that. How can I do that?
