1 / 5

Example: DisplayTiffInfo

Example: DisplayTiffInfo. 指導教授 : 黃文楨 學生 :9624707 林宗道. DisplayTiffInfo 程式碼. macro &quot;Display TIFF Info&quot; { if (getVersion&gt;=&quot;1.39t&quot;) { print(&quot;<br>Image description from '&quot;+getTitle+&quot;':&quot;); print(getInfo(&quot;image.description&quot;)); return; }

rod
Download Presentation

Example: DisplayTiffInfo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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':

More Related