title: Photoshop script - Transform a rectangular selection into an oval one
body: <p>I have a problem that I can't solve.<br />
  I have a rectangular selection (the size doesn't matter) I need to transform to elliptical with a script.<br />
  I would like the elliptical selection to have the same size and position as the rectangular one.
  I managed to put this script together:</p>
  <pre><code>    (NAR = new ActionReference).putProperty (stringIDToTypeID (&quot;channel&quot;), stringIDToTypeID (&quot;selection&quot;));
      (NAD = new ActionDescriptor).putReference (stringIDToTypeID (&quot;null&quot;), NAR);
      (NAD2 = new ActionDescriptor).putUnitDouble (stringIDToTypeID (&quot;top&quot;), stringIDToTypeID (&quot;distanceUnit&quot;), app.activeDocument.selection.bounds[1]);
      NAD2.putUnitDouble (stringIDToTypeID (&quot;left&quot;), stringIDToTypeID (&quot;distanceUnit&quot;), app.activeDocument.selection.bounds[0]);
      NAD2.putUnitDouble (stringIDToTypeID (&quot;bottom&quot;), stringIDToTypeID (&quot;distanceUnit&quot;), app.activeDocument.selection.bounds[3]);
      NAD2.putUnitDouble (stringIDToTypeID (&quot;right&quot;), stringIDToTypeID (&quot;distanceUnit&quot;), app.activeDocument.selection.bounds[2]);
      NAD.putObject (stringIDToTypeID (&quot;to&quot;), stringIDToTypeID (&quot;ellipse&quot;), NAD2);
      NAD.putBoolean (stringIDToTypeID (&quot;antiAlias&quot;), true);
      executeAction (stringIDToTypeID (&quot;set&quot;), NAD, DialogModes.NO);
  </code></pre>
  <p>The script creates an elliptical selection with the same bounds as the existing rectangular selection.<br />
  The problem is that the final measure is too small and moved elsewhere outside the document's edges.<br />
  I've already tried converting the document at 72 DPI without resampling, but it still doesn't give me the correct size.<br />
  I am attaching an image for clarity.</p>
  <p><a href="https://i.stack.imgur.com/ccQT5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ccQT5.jpg" alt="Image" /></a></p>
  <p>Anyone have any ideas?</p>