Ich habe ein Skript, das überprüft, ob ein Bild breiter als 250px ist und wenn es größer als 300px ist und wenn eine dieser Aussagen wahr ist, sollte es ihre Größe ändern passen in diese beiden Werte. Dann sollte es als jpgs mit der Erweiterung groß auf den Dateinamen in einem Ordner namens Large gespeichert werden. Wie auch immer, ich weiß nicht, wie man Photoshop öffnet alle Dateien in einem bestimmten Ordner und führen Sie das Skript, auch ich weiß nicht, wie Sie sie korrekt exportieren, stoppt Photoshop, wenn es versucht, zu exportieren.Öffnen Sie alle PDF-Dateien im Ordner und speichern Sie als geänderte JPGs in anderen Ordner
Hier ist mein Code:
// get a reference to the current (active) document and store it in a variable named "doc"
doc = app.activeDocument;
// change the color mode to RGB. Important for resizing GIFs with indexed colors, to get better results
doc.changeMode(ChangeMode.RGB);
// these are our values for the END RESULT width and height (in pixels) of our image
var fWidth = 250;
var fHeight = 300;
// do the resizing. if height > width (portrait-mode) resize based on height. otherwise, resize based on width
if (doc.height > 300) { doc.resizeImage(null,UnitValue(fHeight,"300"),null,ResampleMethod.BICUBIC); }
else if (doc.width > 250) { doc.resizeImage(null,UnitValue(fWidth,"250"),null,ResampleMethod.BICUBIC); }
// Makes the default background white
var white = new SolidColor();
white.rgb.hexValue = "FFFFFF";
app.backgroundColor = white;
// Convert the canvas size as informed above for the END RESULT app.activeDocument.resizeCanvas(UnitValue(fWidth,"px"),UnitValue(fHeight,"px"));
// our web export options
var options = new ExportOptionsSaveForWeb();
options.quality = 70;
options.format = SaveDocumentType.JPEG;
options.optimized = true;
var newName = 'web-'+doc.name+'.jpg';
doc.exportDocument(File(doc.path+'/images/'+newName);