2012-07-18 38 views
3

我經常將調整大小的圖像(大量)調整爲正方形,然後使用PhotoShop保存它們。例如,如果圖像是400x200,那麼我需要將畫布大小調整爲400x400。同樣,如果圖像是321x850,那麼畫布將調整到850x850,如果圖像是521x250,則畫布將調整大小爲521x521。在PhotoShop中調整批量圖像的尺寸

PhotoShop有沒有一種方法可以自動執行這個單調乏味的任務?我知道PhotoShop的自動化,它記錄你的動作,但這不是我想要的。如果您能指出正確的方向,我對編程解決方案沒有任何問題。這可能嗎?

預先感謝您。這可以節省我幾個小時冗長的重複性工作。

+0

我認爲你應該使用VSO圖像調整器,有時我必須做類似的事情,你必須設置模式爲中心,這就是全部。 – Kamil 2012-07-20 12:29:45

+0

使用JS編寫腳本應該對我很好,謝謝 – Xolani 2012-07-25 12:47:54

回答

7

使用javascript:您可以使用this answer選取所選文件夾中的所有文件並循環播放它們。在循環中,你會想打開每個文件,像這樣:

var doc = open(fileList[i]); 

然後執行長的檢查VS寬度:

if (doc.width !== doc.height) {    // if document is not already square... 
    if (doc.width > doc.height) {    // if width is greater... 
     doc.resizeCanvas(doc.width, doc.width) // use this value for both sides... 
    } else {          // else use height for both sides... 
     doc.resizeCanvas(doc.height, doc.height)  // so you always get a square. 
    } 
} 

保存並關閉:

doc.save(); 
doc.close(); 

根據你在找什麼也有doc.resizeImage()

Adobe scripting guides

+0

謝謝我會試試這個解決方案 – Xolani 2012-07-23 09:40:59

4

批量調整圖片在Mac OS X

您可以輕鬆地批量調整的Mac OS X內一組圖像使用附帶的預覽應用程序,因此不需要任何額外下載或昂貴的照片編輯應用程序,只有預覽,這是免費的與您的Mac!下面是如何做到這一點:

1. Select all the images you want resized and open them within Preview 
2. From Preview, select the images that you want to batch resize from the drawer (Command+A will select them all) 
3. Now, go to the menu labeled Tools, and then Adjust Size 
4. Enter a value for what you want the new width and height to be 
5. Next, navigate to the File menu and click Save All 
6. All the images you selected are now resized! 

這適用於Mac OS X幾乎所有版本都包含的預覽,批量調整大小!

0

使用此腳本它出錯。

if (doc.width !== doc.height) {    // if document is notalready square... 
    if (doc.width > doc.height) {    // if width is greater... 
     doc.resizeCanvas(doc.width, doc.width) // use this value for both sides... 
    else {          // else use height for both sides... 
     doc.resizeCanvas(doc.height, doc.height)  // so you always get a square. 
    } } 

它說,在網上非法使用的其他4

+0

您錯誤地關閉了括號......在else語句之前,您應該有一個單獨的括號。我會推你的最後一個下線,並保持你的縮進/嵌套 - 幫助你發現什麼時候循環不正確 – 2013-11-22 13:41:31

0

錯誤發生,因爲存在丟失的「}」在行結束3 的,如果長期有接近的東西之前期限被打開。

if (doc.width !== doc.height) {    // if document is notalready square... 
if (doc.width > doc.height) {     // if width is greater... 
    doc.resizeCanvas(doc.width, doc.width)} // use this value for both sides... 
else {          // else use height for both sides... 
    doc.resizeCanvas(doc.height, doc.height)} // so you always get a square. 
}