So I decided to use an script and a batch to:
1 - Take any picture, make a square selection on the center of the picture, considering the larger side;
2 - Crop the picture to that square;
3 - Resize the picture to 1200px wide to 1200px tall;
4 - create a white border around the picture, 10% of the overall size of the picture.
As I couldn't find in any place a similar script, using bits and pieces of other sites, I have created my own, which I share with you because this community was my main source of information. Please, don't ask me tough questions, I am not a professional in this field.
Thank you all.
Code: Select all
if(app.documents.length > 0){
var doc = app.activeDocument;
var savedRuler= app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var w = doc.width;
var h = doc.height;
if (w != h){
if(w < h){
// working in portrait mode:
selectedRegion = Array(
Array(0,(h-w)/2), //top left corner
Array(0, (h-w)/2+w), //bottom left corner
Array(w, (h-w)/2+w), //bottom right corner
Array(w, (h-w)/2)//top right corner
);
}else{
// working in landscape mode:
selectedRegion = Array(
Array((w-h)/2,0), //top left corner
Array((w-h)/2+h,0), //bottom left corner
Array((w-h)/2+h,h), //bottom right corner
Array((w-h)/2,h)//top right corner
);
}
doc.selection.select(selectedRegion); // make the selection
doc.crop(doc.selection.bounds); // crop the picture;
doc.resizeImage(UnitValue(1200,"px"),UnitValue(1200,"px"),150,ResampleMethod.BICUBIC,100); // change picture size;
var w = doc.width;
var h = doc.height;
}
// create a white background color;
var backgroundC = new SolidColor();
backgroundC.rgb.red = 255;
backgroundC.rgb.green = 255;
backgroundC.rgb.blue = 255;
backgroundColor = backgroundC;
// resize the canvas size increasing it 10% in all directions from center
doc.resizeCanvas (w*1.1,h*1.1, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = savedRuler;
doc.selection.deselect();
app.purge(PurgeTarget.ALLCACHES);
}