利用Mathematica製作據文字的照片外框
(*首先定義照片路徑,基本上將照片拉到Mathematica的工作視窗類就會產生絕對路徑了,不要真的打~*)
data = {"/Users/chungyuandye/Pictures/iPhoto Library/Originals/2008/H50練拍/DSC00304.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2008/2008:11:9/DSC00866.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Modified/2009/2009:1:3/DSC01368.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:1:3/DSC01389.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Modified/2009/2009:8:9/DSC02525.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Modified/2009/2009:8:19/DSC02580.jpg", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:8:29/DSC02747.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:9:3/DSC02874.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Modified/2009/2009:11:5/DSC03020.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:9:15/DSC02933.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:11:5/DSC03240.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:11:5/DSC03245.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2010/2010:1:26/DSC03584.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2010/2010:4:11/DSC03917.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2009/2009:12:13/DSC03370.JPG", "/Users/chungyuandye/Pictures/iPhoto Library/Originals/2010/2010:2:27/DSC03699.JPG"};
(*分別將檔名取出及照片轉成320x240大小*)
test = {Last@StringSplit[#, "/"] & /@ data, ImageResize[Import[#], 320] & /@ data};
(*將結果輸出,並製作文字標籤於圖形右下方*)
Export["~/1"<>test[[1, #]], ImageCompose[ImagePad[test[[2, #]], 15, Black], Graphics[Text[Style["Chung-Yuan Dye", White, Italic]]], {300, 6}]] & /@ Range[Length@data]
(*或者是將結果寄到自己Email,這功能真的很花俏~~*)
attachment=ImageCompose[ImagePad[test[[2, #]], 15, Black], Graphics[Text[Style["Chung-Yuan Dye", White, Italic]]], {300, 6}] & /@ Range[Length@data]
SendMail["To" -> "chungyuandye@gmail.com",
"Subject" -> "GMail Test Message", "Body" -> attachment,
"From" -> "chungyuandye@gmail.com", "Server" -> "smtp.gmail.com",
"PortNumber" -> 587, "EncryptionProtocol" -> "StartTLS",
"UserName" -> "chungyuandye", "Password" -> "xxxxxxxxxxxxxxx"]
真是簡單迅速有效確實~~
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~