PhotoShop RAW to JPEG Using RUBY + VBA

 不囉嗦,以下是程式碼


#encoding: UTF-8
require 'win32ole'
ps = WIN32OLE.new("Photoshop.Application")

ps.Preferences.RulerUnits = 1
ps.Preferences.TypeUnits = 1


jpeg = WIN32OLE.new("Photoshop.JPEGSaveOptions")
jpeg.Quality = 12

ps.Load("C:\\ps_test\\_MG_5751.CR2")

doc = ps.Documents.Item(1)

w = doc.width
h = doc.height

if( w >= h )
    doc.ResizeImage(1800,nil,nil,7)
else
    doc.ResizeImage(nil,1800,nil,7)
end

doc.SaveAs("C:\\ps_test\\_MG_5751.jpg",jpeg)

doc.close
ps.quit



參考手冊

http://www.adobe.com/devnet/photoshop/scripting.html

留言

這個網誌中的熱門文章