TiffFile Class |
Namespace: Atalasoft.Imaging.Codec.Tiff
The TiffFile type exposes the following members.
Name | Description | |
---|---|---|
Images | Gets the image collection that is part of this TiffFile. | |
TolerateBadTiffStructure |
Gets or sets a value indicating whether to accept truncated tiff files or not.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetPageCount | Returns the number of pages in a TIFF | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnError | Fires the Error event | |
Read(Stream) | Reads directories and tags for all pages. | |
Read(Stream, Int32) | Reads directories and tags for a specific page. | |
Save(Stream) | Saves the TiffFile to a Stream. | |
Save(String) | Saves the TiffFile to a file path. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
CodecError | This event is used by the TiffFile object to report errors that occur when parsing a
TiffDirectory. |
TiffFile oneTiff = new TiffFile(); oneTiff.Read(inputStream); // access a TiffDirectory TiffDirectory image = oneTiff.Images[0]; // access TiffTagCollection TiffTagCollection tags = image.Tags; // add Tiff Tags (add copy-right) tags.Add(new TiffTag(TiffTagID.Copyright, "DotImage")); // add Tiff Tags string datetime = "2005:07:26 09:31:23"; tags.Add(new TiffTag(TiffTagID.DateTime, datetime, TiffTagDataType.Ascii)); // save oneTiff.Save(targetStream);
string sourceFileName = "1_multi.tif"; string tempFileName = "multi_.tif"; using (Stream fs = File.OpenRead(sourceFileName)) { TiffFile tFile = new TiffFile(); tFile.Read(fs); using (TiffDirectory tImage = new TiffDirectory(new AtalaImage(100, 100, PixelFormat.Pixel24bppBgr), TiffCompression.JpegCompression)) { tFile.Images.Insert(1, tImage); tFile.Save(tempFileName); } } File.Delete(sourceFileName); System.IO.File.Move(tempFileName, sourceFileName);