Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
photoshop jsx:photoshopで指定のフォルダのjpgを640pxサイズにリサイズして別のフォルダに移す。
//for PhotoshopCS3
preferences.rulerUnits = Units.PIXELS;
//サムネイルの最大サイズ max pixels
maxpx = 640;
thumbDir = 'thumbnail';
var dirObj = new Folder("C:/Users/name/Pictures/iCloud Photos/Shared/ブログ用");
var files = dirObj.getFiles("*.jpg");
for(var i=0; i<files.length; i++){
var theDoc =[i]);
var w = theDoc.width.value;
var h = theDoc.height.value;
if( w > maxpx){
theDoc.resizeImage(maxpx, h*(maxpx/w), 72, ResampleMethod.BICUBICSHARPER);
var dObj = new Date();
var y = dObj.getFullYear().toString();
var m = dObj.getMonth() + 1;
var d = dObj.getDate();
var str=y+m+d;
var newDir = new Folder("C:/Users/name/Dropbox/EvernoteFolder/blog_img_640/"+str);
if(! newDir.exists){ newDir.create();}
var newFile = new File(newDir.path +'/'+str+"/"+;
var jpegopt = new JPEGSaveOptions();
jpegopt.quality = 7; //0(low)~12(high);
theDoc.saveAs(newFile, jpegopt, true);
//var file=files[i].remove();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.