码迷,mamicode.com
首页 > 其他好文 > 详细

Photoshop脚本之eps转换成jpg

时间:2017-03-29 16:18:53      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:hot   reg   null   regexp   name   imu   jpeg   log   ref   

function saveEPS( doc, saveFile ) {  
     var saveOptions = new JPEGSaveOptions( );  
     saveOptions.encoding = SaveEncoding.JPEGMAXIMUM;  
     doc.saveAs( saveFile, saveOptions, true );  
}

function getAllFiles(folderName,houzhui){
    folderName
    var regthis = new RegExp( .+\.(+houzhui+)$,i);
    var inFolder = new Folder(folderName)
    var fileList = null
    if(inFolder != null){
        var fileList = inFolder.getFiles(regthis);
    }
    return fileList
} 


function print(mess){
    alert(mess)
}

function checkFolder(path){
    var folder = Folder(path)
    if(!folder.exists) folder.create()
}

var inDir = ~/imagesPaper/
var outDir = ~/imagesPaper/
checkFolder(outDir)
files = getAllFiles(inDir,eps)

for(var a = 0 ;a < files.length; a++)
{
    //var fileRef = new File(fileList[a]);
    file =  files[a]
    var doc = open(file);
    var ll = file.name.split(.)
    var shortName = ll[ll.length-2];
    saveEPS( doc, new File(outDir+shortName+.eps) );  
    doc.close();
}

 

Photoshop脚本之eps转换成jpg

标签:hot   reg   null   regexp   name   imu   jpeg   log   ref   

原文地址:http://www.cnblogs.com/huangshiyu13/p/6639745.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!