TiffDirectoryTags Property |
Namespace: Atalasoft.Imaging.Codec.Tiff
Exception | Condition |
---|---|
Thrown when the TiffFile's stream is closed when accessing a tag that is originally loaded as a data pointer. This usually is the case for string and binary data. |
WARNING!!!
TIFF Tags can be edited, added, and removed using this collection property. However the developer is expected to have full understanding of the TIFF specification. Editing tags in ways that are not supported by the TIFF specification can create a corrupt file.
For example, changing the ImageWidth, ImageHeight, Compression, Photometric, and others to an unexpected value will result in a corrupt TIFF file.
When reading TIFF Tags, the TiffFile stream must remain open to read some tags that are populated only when accessing the Data property.
Displays all TIFF Tags from a TIFF document.
TiffFile file = new TiffFile(); using (Stream fs1 = new FileStream("file1.tif", FileMode.Open, FileAccess.Read, FileShare.Read)) { file.Read(fs1); foreach (TiffDirectory image in file.Images) { foreach (TiffTag tag in image.Tags) { Console.WriteLine(tag.ToString()); } } }
Dim file As TiffFile = New TiffFile() Dim fs1 As Stream = New FileStream("file1.tif", FileMode.Open, FileAccess.Read, FileShare.Read) Try file.Read(fs1) ForEach image As TiffDirectory In file.Images ForEach tag As TiffTag In image.Tags Console.WriteLine(tag.ToString()) Next Next Finally fs1.Close() End Try
Adds a new ImageDescription tag to a TIFF File.
TiffFile file = new TiffFile("multi.tif"); file.Images[0].Tags.Add( new TiffTag(TiffTagID.ImageDescription, "Created with the DotImage Example Code", TiffTagDataType.Ascii)); file.Save("multi_newtag.tif");
Dim file As TiffFile = New TiffFile("multi.tif") file.Images(0).Tags.Add( _ New TiffTag(TiffTagID.ImageDescription, _ "Created with the DotImage Example Code", _ TiffTagDataType.Ascii)) file.Save("multi_newtag.tif")