b) { run("Size...", "width=600 height=800"); } else { run("Size...", "width=800 height=600"); } saveAs(format, dir2+list[i]); // 將圖片轉到目的資料夾 close(); }"> b) { run("Size...", "width=600 height=800"); } else { run("Size...", "width=800 height=600"); } saveAs(format, dir2+list[i]); // 將圖片轉到目的資料夾 close(); }">
Download presentation
Presentation is loading. Please wait.
1
BatchConvertToJPEG 姓名 : 康志偉 學號: 9724805 指導老師:黃文楨 教授
2
主程式 macro "Batch Convert to JPEG" {convert("jpeg");} function convert(format) { requires("1.33s"); dir1 = getDirectory(“Choose Source Directory ”); // 選擇來源 Directory dir2 = getDirectory(“Choose Destination Directory ”);// 選擇目的 Directory list = getFileList(dir1); // 將 dir1 目錄的所有檔案,放到 list 陣列 setBatchMode(true);
3
主程式 for (i=0; i<list.length; i++) { // 回圈從第一張圖 ~ 最後一張,依序執行 showProgress(i+1, list.length); open(dir1+list[i]); // 打開圖 if (!endsWith(list[i], ‘.jpg’)) // 判斷檔名中,是否包含.jpg print("Not JPEG: "+dir1+list[i]); else { a = getHeight(); b = getWidth(); if (a>b) { run("Size...", "width=600 height=800"); } else { run("Size...", "width=800 height=600"); } saveAs(format, dir2+list[i]); // 將圖片轉到目的資料夾 close(); }
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.