Copy link to clipboard
Copied
Hi I have downloaded this script.
Golden Crop for Photoshop - FAQ
And I have been able to alter the script for my own overlay.
Its quite an in depth script but super useful.
I have a few more changes that I would like to put in place.
prior to the crop make the canvas fit the ratio of 2:3 and expand where required.
When you transform the crop mask I would like the width and height linked. (fixed ratio) I think it can be found around line 2123 (I'm guessing this is where I might need to be place it.
Can the transforms anchor point be changed to a specific location? That point would be x=(w/2), y=(131/408)*h Where w and h are the original dimensions.
Also with the last menus prompts 'Canvas extension detected' can this be default to and choose Crop style be defaulted to [1] so that there are less prompts.
A lot to ask, but I am not too familiar with the photoshop script more with applescript.
Many Thanks
Matt
Copy link to clipboard
Copied
You don't need script for this. This is already built-in Photoshop.
Copy link to clipboard
Copied
This doesn't allow a custom overlay. True everything in the old script is in the CC however I said I managed to alter the code for a custom overlay. I need to move the anchor point to the centre of my cross but, by default and lock the aspect ratio.
Copy link to clipboard
Copied
You probably could replace opening transform mode with my code. You can set some default values for transformation mode.
var idTrnf = charIDToTypeID( "Trnf" );
var desc59 = new ActionDescriptor();
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsi = charIDToTypeID( "Qcsi" );
desc59.putEnumerated( idFTcs, idQCSt, idQcsi );
var idPstn = charIDToTypeID( "Pstn" );
var desc60 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc60.putUnitDouble( idHrzn, idPxl, 202.000000 ); // anchor X
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc60.putUnitDouble( idVrtc, idPxl, 141.000000 ); // anchor Y
var idPnt = charIDToTypeID( "Pnt " );
desc59.putObject( idPstn, idPnt, desc60 );
var idLnkd = charIDToTypeID( "Lnkd" );
desc59.putBoolean( idLnkd, true ); // keep aspect ratio
executeAction( idTrnf, desc59, DialogModes.ALL ); //DialogModes.ALL = keep transform mode open
Copy link to clipboard
Copied
I had a look in the code and this is the area I believe the transform takes place.
I tried to sandwich the line in after line 11
But the that ddin't work for me and caused the script to stop wrk (no specific error as it is running from within photoshop )
Thanks
Matt
Stdlib.userGoToFreeTransform = function(doc, layer) {
function _ftn() {
function preMove() {
var desc = new ActionDescriptor();
var lref = new ActionReference();
lref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
desc.putReference(cTID("null"), lref);
desc.putEnumerated(cTID("FTcs"), cTID("QCSt"), cTID("Qcsa"));
var desc75 = new ActionDescriptor();
desc75.putUnitDouble( cTID('Hrzn'), cTID('#Pxl'), 1.000000 );
desc75.putUnitDouble( cTID('Vrtc'), cTID('#Pxl'), 1.000000 );
desc.putObject( cTID('Ofst'), cTID('Ofst'), desc75 );
executeAction(cTID("Trnf"), desc, DialogModes.NO);
}
function retPostMoveDesc() {
var desc = new ActionDescriptor();
var lref = new ActionReference();
lref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
desc.putReference(cTID("null"), lref);
desc.putEnumerated(cTID("FTcs"), cTID("QCSt"), cTID("Qcsa"));
var desc75 = new ActionDescriptor();
desc75.putUnitDouble( cTID('Hrzn'), cTID('#Pxl'), -1.000000 );
desc75.putUnitDouble( cTID('Vrtc'), cTID('#Pxl'), -1.000000 );
desc.putObject( cTID('Ofst'), cTID('Ofst'), desc75 );
return desc;
}
var state = true;
preMove();
var lvl = $.level;
$.level = 0;
try {
executeAction(cTID("Trnf"), retPostMoveDesc(), DialogModes.ALL);///ALL
} catch (e) {
state = false;
if (e.number != 8007) { // if not "User cancelled"
throw e;
}
executeAction(cTID("Trnf"), retPostMoveDesc(), DialogModes.NO);
} finally {
$.level = lvl;
}
return state;
}
return Stdlib.wrapLCLayer(doc, layer, _ftn)
}