Login  Register

Re: add/edit a comment and store it with an image?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Dec 20, 2010; 6:06pm
URL: http://imagej.273.s1.nabble.com/add-edit-a-comment-and-store-it-with-an-image-tp3685672p3685675.html

On Dec 20, 2010, at 10:30 AM, Michael Schmid wrote:

> Hi everyone,
>
> though I consider myself a seasoned ImageJ user, a beginner's  
> question (sorry if I have overlooked something trivial)
>
> Is there a way to have a comment or some other text that I can edit,  
> have it stored with the image (in the .tif or .zip file), retrieve it  
> later? (and maybe edit it, store the image again...)
>
> Of course, I could write a plugin for this, adding a String to the  
> image metadata, but I don't want to reinvent the wheel.
> (The TIFF 'description' tag seems to be in use already, storing  
> calibration, min&max)

You can add text to an image using the the Edit>Copy to Image Info command in the text editor. You can retrieve the text, which is saved in the TIFF header, by pressing the "i" key (Image>Show Info). Macros can add text to an image by calling setMetadata("Info", string) and retrieve it using getMetadata("Info"). Plugins can add text to an image using imp.setProperty("Info", String) and retrieve it using text=(String)imp.getProperty("Info").

-wayne