# How to insert shape and keep original aspect ration with UXP

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-insert-shape-and-keep-original-aspect-ration-with-uxp/9415>\
**Category:** UXP Plugin API\
**Tags:** uxp, uxp-developer-tool\
**Created:** [February 18, 2025, 12:35pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-insert-shape-and-keep-original-aspect-ration-with-uxp/9415 "2025-02-18T12:35:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![karpiyon](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@karpiyon](https://forums.creativeclouddeveloper.com/u/karpiyon)\
**Post date:** [February 18, 2025, 12:35pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-insert-shape-and-keep-original-aspect-ration-with-uxp/9415/1 "2025-02-18T12:35:55Z")

</div>

Hi,  
I am using the following to add a custom shape to the image.  
What I am struggling with is how do i keep the original shape aspect ration.  
If I place the shape manually I hold the Shift key to keep proportions.  
In UXP I need to specify the size.  
So how can I maintain the original aspect ration, or how can I know the original shape dimensions.

```auto
async function myAddLogo(logoName, color, coord) {
   // const { app, core, action } = require("photoshop");
   await require("photoshop").core.executeAsModal(async (executionControl, descriptor) => {
      const result = await batchPlay(
         [
            {
               _obj: "make",
               _target: [
                  {
                     _ref: "contentLayer"
                  }
               ],
               using: {
                  _obj: "contentLayer",
                  type: {
                     _obj: "solidColorLayer",
                     color: { 
                        _obj: "RGBColor",
                        red: color.red,
                        grain: color.grain,
                        blue: color.blue
                     }
                  },
                  shape: {
                     _obj: "customShape",
                     name: logoName,
                     keyOriginType: 9,
                     top: {
                        _unit: "pixelsUnit",
                        _value: coord.top
                     },
                     left: {
                        _unit: "pixelsUnit",
                        _value: coord.left
                     },
                     bottom: {
                        _unit: "pixelsUnit",
                        _value: coord.bottom
                     },
                     right: {
                        _unit: "pixelsUnit",
                        _value: coord.right
                     }
                  }
               },
               _options: {
                  dialogOptions: "dontDisplay"
               }
            }
         ],
      {});
   });
}

```
