I have a problem that I can't solve.
I have a rectangular selection (the size doesn't matter) I need to transform to elliptical with a script.
I would like the elliptical selection to have the same size and position as the rectangular one.
I managed to put this script together:
(NAR = new ActionReference).putProperty (stringIDToTypeID ("channel"), stringIDToTypeID ("selection"));
(NAD = new ActionDescriptor).putReference (stringIDToTypeID ("null"), NAR);
(NAD2 = new ActionDescriptor).putUnitDouble (stringIDToTypeID ("top"), stringIDToTypeID ("distanceUnit"), app.activeDocument.selection.bounds[1]);
NAD2.putUnitDouble (stringIDToTypeID ("left"), stringIDToTypeID ("distanceUnit"), app.activeDocument.selection.bounds[0]);
NAD2.putUnitDouble (stringIDToTypeID ("bottom"), stringIDToTypeID ("distanceUnit"), app.activeDocument.selection.bounds[3]);
NAD2.putUnitDouble (stringIDToTypeID ("right"), stringIDToTypeID ("distanceUnit"), app.activeDocument.selection.bounds[2]);
NAD.putObject (stringIDToTypeID ("to"), stringIDToTypeID ("ellipse"), NAD2);
NAD.putBoolean (stringIDToTypeID ("antiAlias"), true);
executeAction (stringIDToTypeID ("set"), NAD, DialogModes.NO);
The script creates an elliptical selection with the same bounds as the existing rectangular selection.
The problem is that the final measure is too small and moved elsewhere outside the document's edges.
I've already tried converting the document at 72 DPI without resampling, but it still doesn't give me the correct size.
I am attaching an image for clarity.
Anyone have any ideas?
