Photoshop脚本之jpg转换成eps
原创
©著作权归作者所有:来自51CTO博客作者wx62d12289ce45b的原创作品,请联系作者获取转载授权,否则将追究法律责任
function saveEPS( doc, saveFile ) {
var saveOptions = new EPSSaveOptions( );
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 = '~/origin/'
var outDir = '~/out/'
checkFolder(outDir)
files = getAllFiles(inDir,'jpg')
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();
}
脚本功能:
把某个文件夹下的jpg格式的图片全部转换成便于储存的eps格式图片。
黄世宇/Shiyu Huang's Personal Page:https://huangshiyu13.github.io/