Make an elliptical selection

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

rcvalle

Make an elliptical selection

Post by rcvalle »

Hi,

How do I make an elliptical selection from a script? Thanks in advance.

Best regards,

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Paul MR

Make an elliptical selection

Post by Paul MR »

Here's one example...
Code: Select allif(documents.length){
var StrokePixels = 5;
var Colour = new SolidColor;
Colour.rgb.hexValue = '0000ff';
var Width = activeDocument.width.as('px');
var Height = activeDocument.height.as('px');
Circle(0,0,Height,Width,0);
activeDocument.selection.stroke (Colour, StrokePixels, StrokeLocation.INSIDE,ColorBlendMode.NORMAL,100);
activeDocument.selection.deselect();
}

function Circle(Top,Left,Bottom,Right,Feather) {
if(Feather == undefined) Feather = 0;
var desc3 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') );
    desc3.putReference( charIDToTypeID('null'), ref1 );
        var desc4 = new ActionDescriptor();
        desc4.putUnitDouble( charIDToTypeID('Top '), charIDToTypeID('#Pxl'), Top );
        desc4.putUnitDouble( charIDToTypeID('Left'), charIDToTypeID('#Pxl'), Left );
        desc4.putUnitDouble( charIDToTypeID('Btom'), charIDToTypeID('#Pxl'), Bottom );
        desc4.putUnitDouble( charIDToTypeID('Rght'), charIDToTypeID('#Pxl'), Right );
    desc3.putObject( charIDToTypeID('T   '), charIDToTypeID('Elps'), desc4 );
    desc3.putUnitDouble( charIDToTypeID('Fthr'), charIDToTypeID('#Pxl'), Feather );
    desc3.putBoolean( charIDToTypeID('AntA'), true );
    executeAction( charIDToTypeID('setd'), desc3, DialogModes.NO );
}; 
rcvalle

Make an elliptical selection

Post by rcvalle »

Thank you Paul!