hi im using the script but I want to change the last part to instead of using backgound color to use content aware fill
Here is a script to make the image square, using the longest side of the image, then using content aware fill.
#target photoshop
var savedRuler = app.preferences.rulerUnits; //save the current ruler units
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument
var newSize = Math.max(doc.width.value,doc.height.value);
var topS,leftS,bottomS,rightS
if(doc.width>doc.height){
topS = -(newSize-doc.height.value)/2;
leftS = 0;
bottomS = (newSize-doc.height.value)/2 + doc.height.value;
rightS = doc.width.value;
cropContentAware ();
}
else if(doc.height>doc.width){
topS = 0;
leftS = -(newSize-doc.width.value)/2;
bottomS = doc.height.value;
rightS = (newSize-doc.width.value)/2 + doc.width.value;
cropContentAware ();
}
else{}
app.preferences.rulerUnits = savedRuler; //restore the original ruler units
function cropContentAware(){
var idCrop = charIDToTypeID( "Crop" );
var desc363 = new ActionDescriptor();
var idT = charIDToTypeID( "T " );
var desc364 = new ActionDescriptor();
var idTop = charIDToTypeID( "Top " );
var idPxl = charIDToTypeID( "#Pxl" );
desc364.putUnitDouble( idTop, idPxl, topS );
var idLeft = charIDToTypeID( "Left" );
var idPxl = charIDToTypeID( "#Pxl" );
desc364.putUnitDouble( idLeft, idPxl, leftS );
var idBtom = charIDToTypeID( "Btom" );
var idPxl = charIDToTypeID( "#Pxl" );
desc364.putUnitDouble( idBtom, idPxl, bottomS );
var idRght = charIDToTypeID( "Rght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc364.putUnitDouble( idRght, idPxl, rightS );
var idRctn = charIDToTypeID( "Rctn" );
desc363.putObject( idT, idRctn, desc364 );
var idAngl = charIDToTypeID( "Angl" );
var idAng = charIDToTypeID( "#Ang" );
desc363.putUnitDouble( idAngl, idAng, 0.000000 );
var idDlt = charIDToTypeID( "Dlt " );
desc363.putBoolean( idDlt, false );
var idautoFill = stringIDToTypeID( "autoFill" );
desc363.putBoolean( idautoFill, true );
var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
var idpureAspectRatio = stringIDToTypeID( "pureAspectRatio" );
desc363.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idpureAspectRatio );
var idCnsP = charIDToTypeID( "CnsP" );
desc363.putBoolean( idCnsP, false );
executeAction( idCrop, desc363, DialogModes.NO );
}