mystringplot[mystring_String,mypath_String,filetype_String]:=Block[{data,fn,n}, (*文字轉成資料陣列*) data=Reverse[Rasterize[mystring,RasterSize->50,ImageSize->200][[1, 1]]/.{x_,y_,z_}:>If[Mean[{x,y,z}]>255/3,1,0]]; (*選擇檔案路徑*) fn=RandomChoice[FileNames[filetype,mypath,Infinity], Length@Position[Flatten[data],0]]; (*輸出圖形*) GraphicsGrid[n=1;data/.{1->"",0:>Import[fn[[n++]]]}] ] mystringplot["3","/Users/chungyuandye/Pictures","*face*.jpg"]
Mathematica 教學 Just for Fun 將照片依照指定文字排列
由 戴忠淵 於 2012年11月11日星期日
下午5:41 發表
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~