TIFF Tags

Author: Joachim Wesner (joachim.wesner at leica-microsystems.com)
History: 2009/09/11: first version
Source: Included in tiff_tags.jar
Installation: Download tiff_tags.jar to the plugins folder, or subfolder, run Help>Update Menus, and there will be a new "Tiff Tags" command in the Plugins menu or submenu.
Description: This is a simple IJ plugin that displays all of the tags of a specified TIFF file. It only lists the first elements of a multiple element tag up to an approximate total string length, which can be specified in the dialog. Tags with field type of 2 (ASCII) are (optionally) printed as strings, where control chars (< 32) are replaced by blanks.

This version now retains large unsigned values as such and list the results in it's own TextWindow. It also adds three static methods (in two variants each) to get the information on arbitrary TIFF tags of a given file, which can be called from the ImageJ macro language, i.e. for example as:

    tag = call("TIFF_Tags.getTag", path, tag);
Method descriptions:
    public static String getTag(String path, int tag);
    public static String getTag(String path, int tag, int ifd);
Tries to read the tag with id tag and IFD ifd from the file given by path. If ifd is missing, IFD 1 is assumed. If the tag is not found, an empty string is returned. If the file cannot be opened or another error occurs, the string "*Err*" is returned. Tags with numerical value are converted to decimal ASCII strings, separated by blanks.
    public static int getTagCount(String path, int tag);
    public static int getTagCount(String path, int tag, int ifd);
Returns the number of elements for the specified tag, or zero if the tag is not found, or -1 if an error occurs.
    public static int getTagType(String path, int tag);
    public static int getTagType(String path, int tag, int ifd);
Returns the "field type" of the given tag as given by the TIFF standard (for the numerical values see the constant definitions below. Returns zero if the tag is not found or -1 if an error occurs.
See Also:
  • The SetScaleFromTiffTag macro uses this plugin to set the scale for SEM images taken with the Carl Zeiss SmartSEM program.
  • The TIFF Dumper plugin uses the Bio-Formats plugin to display the tags of the current image.
  • The "Debug mode" option in Edit>Options>Misc, when enabled, causes ImageJ to display tags when opening TIFF images.
  • The Image>Show Info command and the getMetadata() macro function(), in v1.43g or later, retrieve ASCII tags, such as "DateTime" and "Software".
  • Image>Show Info and getMetadata() retrieve the tags of TIFF images opened using the Bio-Formats plugin.

|Plugins | Home |