You can set tags for a TIFF file by specifying the tag name, the tag numeric identifier, or by specifying a structure of multiple tag names and values.
Create a new TIFF file, write image data, and then set tag values in different ways.
Read sample data into an array, imdata
. Create a Tiff
object associated with a new file, myfile.tif
, and open the file for writing.
Set tag values by specifying the tag name.
Set tag values by specifying the numeric tag identifier. Use the fields of the Tiff.TagID
structure to obtain the tag IDs. For instance, the Tiff.TagID.ImageLength
contains the numeric identifier for the ImageLength
tag.
Create a structure with fields named after TIFF tags and assign values to the fields. Pass this structure to the setTag
method to set the values of these tags.
Write the image data to the TIFF file and close the Tiff
object.