相关日志
-
-
分享
Batch splitting images in 2 with arbitrary sizes
-
WangLuoxuan 2012-5-27 00:20
-
http://www.photoshopgurus.com/forum/photoshop-newbies/36251-help-batch-splitting-images-2-arbitrary-sizes.html #target photoshop app.bringToFront(); function main(){ var inputFolder= Folder.selectDialog ("Please select folder to process"); if(inputFolder == null) return; var fileList = inputFolder.getFiles("*.jpg"); var outFolder = Folder(inputFolder +"/Processed"); if(!outFolder.exists) outFolder.create(); for(var z in fileList){ open(fileList ); var doc = activeDocument; var Name = decodeURI(fileList .name.replace(/\. +$/, '')); var startRulerUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.PIXELS; var LB= = 0; LB = 0; LB = 512; LB = doc.height.value; doc.selection.select( ,LB ], ,LB ], ,LB ], , LB ]], SelectionType.REPLACE, 0, false); var savedState = doc.activeHistoryState; executeAction( charIDToTypeID( "Crop" ), undefined, DialogModes.NO ); saveFile= File(outFolder + "/" + Name + "-512.jpg"); SaveForWeb(saveFile,80); doc.activeHistoryState = savedState; doc.selection.invert(); executeAction( charIDToTypeID( "Crop" ), undefined, DialogModes.NO ); saveFile= File(outFolder + "/" + Name + "-rest.jpg"); SaveForWeb(saveFile,80); app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); app.preferences.rulerUnits = startRulerUnits; } } main(); function SaveForWeb(saveFile,jpegQuality) { var sfwOptions = new ExportOptionsSaveForWeb(); sfwOptions.format = SaveDocumentType.JPEG; sfwOptions.includeProfile = false; sfwOptions.interlaced = 0; sfwOptions.optimized = true; sfwOptions.quality = jpegQuality; //0-100 activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions); }
-
个人分类: 笔记工程|26 次阅读|0 个评论
GMT+8, 2025-12-26 01:21