Copy link to clipboard
Copied
This may be impossible but I'm wondering if there's any way to do this with photoshop. For my Wordpress I make featured images that are 1200x628, the common Wordpress featured image size. But for my podcast, the common episode image size is square. So what I wanted to do is design my podcast episode images on a 1200x1200 canvas and only design the important parts within the middle 1200x628, then save two copies, one at the full 1200x1200 uncropped image, and one cropped to 1200x628.
Now ideally I'd love a batch or script or something that in one smooth process exports both versions for me at once. I'd settle though for being able to export a version as normal (the 1200x1200 as it's been designed in photoshop), and then a second step where I can set it to export at 1200x628...
Right now the only way I can achieve this would be export the regular as designed 1200x1200. Go to canvas size and change it to 1200x628 (anchored in the middle). Export another copy at its new current size. Undo my cavnas size change so it's back to normal for any future edits.
I guess I'm trying to get 4 steps down to 1, but would settle for 2.
Any ideas?
Try this script. It will make a merged duplicate of your file, save it, which should be at 1200X1200, then crop down to 1200X628 and save again. Then it will close the duplicated file, and you will be back to your original file. It will save in the same place as your original file, so it has to be save for the script to work.
#target photoshop
app.displayDialogs = DialogModes.NO;
var jpgOptions = new JPEGSaveOptions();
jpgOptions.quality = 8;
var doc = activeDocument;
var docName = doc.name.
...
Copy link to clipboard
Copied
What file type do you save to: jpg?
Copy link to clipboard
Copied
yeah in this case jpg. png would be fine too i think. but i'd probably just do jpg.
Copy link to clipboard
Copied
Try this script. It will make a merged duplicate of your file, save it, which should be at 1200X1200, then crop down to 1200X628 and save again. Then it will close the duplicated file, and you will be back to your original file. It will save in the same place as your original file, so it has to be save for the script to work.
#target photoshop
app.displayDialogs = DialogModes.NO;
var jpgOptions = new JPEGSaveOptions();
jpgOptions.quality = 8;
var doc = activeDocument;
var docName = doc.name.split('.')[0];
var saveFolder = new Folder(doc.path);
dupeImag ();
var dupeDoc = activeDocument;
dupeDoc.saveAs (new File(doc.path + '/' + docName + '--1200.jpg'),jpgOptions);
cropImg ();
dupeDoc.saveAs (new File(doc.path + '/' + docName + '--628.jpg'),jpgOptions);
dupeDoc.close(SaveOptions.DONOTSAVECHANGES)
function dupeImag(){
var idDplc = charIDToTypeID( "Dplc" );
var desc1542 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref13 = new ActionReference();
var idDcmn = charIDToTypeID( "Dcmn" );
var idOrdn = charIDToTypeID( "Ordn" );
var idFrst = charIDToTypeID( "Frst" );
ref13.putEnumerated( idDcmn, idOrdn, idFrst );
desc1542.putReference( idnull, ref13 );
var idNm = charIDToTypeID( "Nm " );
desc1542.putString( idNm, """1200 crop""" );
var idMrgd = charIDToTypeID( "Mrgd" );
desc1542.putBoolean( idMrgd, true );
var idDocI = charIDToTypeID( "DocI" );
desc1542.putInteger( idDocI, 159 );
executeAction( idDplc, desc1542, DialogModes.NO );
}
function cropImg(){
var idCrop = charIDToTypeID( "Crop" );
var desc1511 = new ActionDescriptor();
var idT = charIDToTypeID( "T " );
var desc1512 = new ActionDescriptor();
var idTop = charIDToTypeID( "Top " );
var idPxl = charIDToTypeID( "#Pxl" );
desc1512.putUnitDouble( idTop, idPxl, 286 );
var idLeft = charIDToTypeID( "Left" );
var idPxl = charIDToTypeID( "#Pxl" );
desc1512.putUnitDouble( idLeft, idPxl, 0.000000 );
var idBtom = charIDToTypeID( "Btom" );
var idPxl = charIDToTypeID( "#Pxl" );
desc1512.putUnitDouble( idBtom, idPxl, 914 );
var idRght = charIDToTypeID( "Rght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc1512.putUnitDouble( idRght, idPxl, 1200.000000 );
var idRctn = charIDToTypeID( "Rctn" );
desc1511.putObject( idT, idRctn, desc1512 );
var idAngl = charIDToTypeID( "Angl" );
var idAng = charIDToTypeID( "#Ang" );
desc1511.putUnitDouble( idAngl, idAng, 0.000000 );
var idDlt = charIDToTypeID( "Dlt " );
desc1511.putBoolean( idDlt, false );
var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
var idpureAspectRatio = stringIDToTypeID( "pureAspectRatio" );
desc1511.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idpureAspectRatio );
var idCnsP = charIDToTypeID( "CnsP" );
desc1511.putBoolean( idCnsP, false );
executeAction( idCrop, desc1511, DialogModes.NO );
}
Copy link to clipboard
Copied
you are AMAZING. thank you!
Copy link to clipboard
Copied
Glad I got something that now working for you.