Download presentation
Presentation is loading. Please wait.
1
Example: DisplayTiffInfo 指導教授 : 黃文楨 學生 :9624707 林宗道
2
DisplayTiffInfo 程式碼 macro "Display TIFF Info" { if (getVersion>="1.39t") { print("\nImage description from '"+getTitle+"':"); print(getInfo("image.description")); return; } setBatchMode(true); 背景執行 id = getImageID(); title = getTitle(); if (indexOf(toLowerCase(title), “.tif”)==-1) 沒有找到特定字串 exit("The macro requires a TIFF image"); dir = getDirectory("image"); if (isOpen(“Log”)) { 如果有 log 時,將關閉 ”image” 且開啟 log selectWindow("Log"); run("Close"); }
3
開啟偵錯控制項 ( ㄧ ) setOption("DebugMode", true); open(dir+title); 開啟新視窗 close(); run("Misc...", "divide=Infinity antialiased"); selectWindow("Log"); info = getInfo(); 把錯誤訊息回傳到 getinfo run("Close");
4
開啟偵錯控制項 ( 二 ) setOption(“DebugMode”, false); 關閉偵錯控制項 index1 = indexOf(info, "Image Description:"); if (index1==-1) 表示沒有找到特定字串 exit("This TIFF does not appear to have an image description tag"); index1 += 19; index2=indexOf(info, “\n”, index1); 找到有 ”\n” 回傳到 index1 data = substring(info, index1,index2); ( 起始索引, 終止索引 ) if (lengthOf(data)>200 && indexOf(data, "\n")==-1) exit("The image description is longer than 200 characters."); showMessage ("Image description from "+title, data);
5
執行結果 Image description from 'Sunset.jpg':
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.