2013-01-16 32 views
0

我需要將兩個圖像系列(兩個分辨率相同,保存爲JPG文件)合併爲一個JPG文件,並且圖像並排放置在一起。我已經嘗試過使用Photoshop CS6操作執行此操作,但無濟於事......我已經在互聯網上搜索了可能的解決方案,但事實證明編程知識需要編寫腳本來執行此類功能。我想有任何的幫助可能有以下幾點:如何在Photoshop中將兩個獨特的圖像批量合併爲一個並排的圖像?

我的文件名是這樣:一個

系列:bone00001.jpg,bone00002.jpg ... bone00060.jpg 系列二:st00001.jpg ,st00002.jpg ... st00060.jpg

我希望它們並排組合,以便「骨」系列位於左側,「st」系列位於右側,最後一個系列導出爲done00001.jpg ... done00060.jpg

任何人都可以用這個Photoshop腳本來幫助我嗎?

+1

這個問題錯誤的地點。 – adamdehaven

回答

1

亞當D是正確的 - 你最好在Adobe forums詢問。但幸運的是,您的要求與a question asked a while back非常相似。 劇本是粗糙的;但它會做你想做的: 圖像需要是相同的大小。如果骨骼圖像比掃描圖像小,它會看起來很亂,並且不起作用。

將其另存爲.jsx文件。它可以通過文件>腳本菜單在PS中進行訪問。

負載在骨骼圖像,運行腳本之一 - 然後將找到匹配的掃描圖像,並通過邊把它們端和出保存爲bone_XXXX_done.jpg(XXXX爲數字)

var srcDoc = app.activeDocument; 

// call the current document 
var srcDoc = app.activeDocument; 

// set original width and height 
var imageW = srcDoc.width.value; 
var imageH = srcDoc.height.value; 

// get the info out of the source doc 
var fileName = srcDoc.name; 
var docName = fileName.substring(0,fileName.length -4); 
var filePath = srcDoc.path.toString(); 
var fileExt = fileName.substring(fileName.length -4, fileName.length); 

var nameCheck = fileName.substring(0,fileName.indexOf("bone")); 

if (nameCheck <1) 
{ 
    var fileNum = fileName.substring(4,fileName.length -4); 
    // no underscore so we need to open it's namesake 
    // alert(nameCheck) 
    var filePair = filePath + "/" + "st" + fileNum + fileExt; 
    openThisFile(filePair) 
    activeDocument.selection.selectAll() 
    activeDocument.selection.copy(); 
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
    app.activeDocument = srcDoc; 
    activeDocument.resizeCanvas(imageW *2, imageH, AnchorPosition.MIDDLELEFT); 
    selectRect(0, imageW, imageW*2, imageH) 
    activeDocument.paste() 
    activeDocument.flatten(); 
    var newName = filePath + "/" + docName + "_done" + fileExt 
    saveMe(newName) 
} 
    else 
    { 
     app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
    } 


function openThisFile(masterFileNameAndPath) 
{ 
var fileRef = new File(masterFileNameAndPath) 
if (fileRef.exists) 
//open that doc 
{ 
    app.open(fileRef); 
} 
else 
{ 
    alert("error opening " + masterFileNameAndPath) 
} 
} 


function selectRect(top, left, right, bottom) 
{ 
    srcDoc.selection.deselect() 
    // ======================================================= 
    var id1 = charIDToTypeID("setd"); 
    var desc1 = new ActionDescriptor(); 
    var id2 = charIDToTypeID("null"); 
    var ref1 = new ActionReference(); 
    var id3 = charIDToTypeID("Chnl"); 
    var id4 = charIDToTypeID("fsel"); 
    ref1.putProperty(id3, id4); 
    desc1.putReference(id2, ref1); 
    var id5 = charIDToTypeID("T "); 
    var desc2 = new ActionDescriptor(); 
    var id6 = charIDToTypeID("Top "); 
    var id7 = charIDToTypeID("#Pxl"); 
    desc2.putUnitDouble(id6, id7, top); 
    var id8 = charIDToTypeID("Left"); 
    var id9 = charIDToTypeID("#Pxl"); 
    desc2.putUnitDouble(id8, id9, left); 
    var id10 = charIDToTypeID("Btom"); 
    var id11 = charIDToTypeID("#Pxl"); 
    desc2.putUnitDouble(id10, id11, bottom); 
    var id12 = charIDToTypeID("Rght"); 
    var id13 = charIDToTypeID("#Pxl"); 
    desc2.putUnitDouble(id12, id13, right); 
    var id16 = charIDToTypeID("Rctn"); 
    desc1.putObject(id5, id16, desc2); 
    executeAction(id1, desc1, DialogModes.NO); 
} 

function saveMe(fPath) 
{ 

// save out the image as jpeg 
var jpgFile = new File(fPath); 
jpgSaveOptions = new JPEGSaveOptions(); 
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE; 
jpgSaveOptions.embedColorProfile = true; 
jpgSaveOptions.matte = MatteType.NONE; 
jpgSaveOptions.quality = 12; 

activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE); 

// close that saved jpg 
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
} 
相關問題