In This Topic
Tagged Image File Format (TIFF) is a file format for storing raster graphics images that typically comes from scanners, frame grabbers, paint- and photo-retouching programs. TIFF file may contain single or multiple pages. TIFF file size cannot be greater than 4Gb.
BigTIFF is an extension of format in which TIFF file size can be greater than 4Gb.
VintaSoft Imaging .NET SDK has a set of classes for easy manipulation with TIFF and BigTIFF files.
SDK supports:
- Reading and writing of TIFF and BigTIFF files in little- and big-endian formats
-
Reading of the following TIFF image formats:
- 1-bpp black-white
- from 1- to 32-bpp, 64-bpp grayscale
- from 1- to 16-bpp palette
- from 3- to 96-bpp, 128-bpp RGB
- 32- and 64-bpp RGBA
- 32- and 64-bpp CMYK
- 40-bpp CMYKA
- 8-, 16-, 24- and 48-bpp YCbCr
- 24-bpp CIELab
-
Writing of the following TIFF image formats:
- 1-bpp black-white
- 4- and 8-bpp grayscale
- 1-, 4- and 8-bpp palette
- 24- and 48-bpp RGB
- 32- and 64-bpp RGBA
-
Decoding of TIFF images compressed with the following algorithm:
- No compression
- CCITT Group 3 fax
- CCITT Group 4 fax
- CCITT Rle
- Macintosh Packbits
- LZW
- ZIP
- Old JPEG
- JPEG
-
JPEG2000 - VintaSoft JPEG2000 .NET Plug-in is necessary
-
Encoding of TIFF images using the following algorithms:
TiffFile class
TiffFile class allows to:
Here is C#/VB.NET code that shows how to create new TIFF file in little-endian (Intel) format:
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileFormat.LittleEndian);
Dim tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileFormat.LittleEndian)
Here is C#/VB.NET code that shows how to load an existing TIFF file:
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif");
Dim tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif")
TiffPageCollection class
TiffPageCollection class allows to:
Here is C#/VB.NET code that shows how to load multipage TIFF file, add JPEG image to the end of TIFF file, insert PNG image at the beginning of TIFF file and remove third page from TIFF file:
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif");
tiffFile1.Pages.Add(new Vintasoft.Imaging.VintasoftImage("image.jpg"));
tiffFile1.Pages.Insert(0, new Vintasoft.Imaging.VintasoftImage("image.png"));
tiffFile1.Pages.RemoveAt(2);
tiffFile1.SaveChanges();
Dim tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif")
tiffFile1.Pages.Add(New Vintasoft.Imaging.VintasoftImage("image.jpg"))
tiffFile1.Pages.Insert(0, New Vintasoft.Imaging.VintasoftImage("image.png"))
tiffFile1.Pages.RemoveAt(2)
tiffFile1.SaveChanges()
TiffPage class
TiffPage class allows to:
The following image compression algorithms are supported for images stored in TIFF page:
- None (read/write)
- CCITT Group 3 fax (read)
- CCITT Group 4 fax (read/write)
- CCITT Rle (read)
- Macintosh Packbits (read)
- LZW (read/write)
- ZIP (read/write)
- Old JPEG (read)
- JPEG (read/write)
- JPEG2000 (read/write)
Here is C#/VB.NET code that shows how to get the first page of TIFF file as VintasoftImage object:
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif");
Vintasoft.Imaging.VintasoftImage pageImage = tiffFile1.Pages[0].GetImage();
Dim tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif")
Dim pageImage As Vintasoft.Imaging.VintasoftImage = tiffFile1.Pages(0).GetImage()
TiffImageFileDirectory class
TiffImageFileDirectory class allows to:
TiffTagCollection class
TiffTagCollection class allows to:
Tag with ID from the
ReadOnlyTiffTagId enumeration cannot be added/modified/removed.
Here is C#/VB.NET code that shows how to add/modify/delete tags of TIFF file:
using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(@"image-with-tags.tif"))
{
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags = tiffFile1.Pages[0].IFD.Tags;
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software, "VintaSoft Imaging .NET SDK v8.2");
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Make, "VintaSoft LLC.");
tags.Add((ushort)0xE001, "BarcodeInfo");
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "2009:03:03 10:20:05");
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.XResolution,
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1));
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.YResolution,
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1));
tags.Remove(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.PrintImageMatching);
tiffFile1.SaveChanges();
}
Using tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("image-with-tags.tif")
Dim tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection = tiffFile1.Pages(0).IFD.Tags
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software, "VintaSoft Imaging .NET SDK v8.2")
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Make, "VintaSoft LLC.")
tags.Add(CUShort(&He001), "BarcodeInfo")
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "2009:03:03 10:20:05")
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.XResolution, New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1))
tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.YResolution, New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1))
tags.Remove(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.PrintImageMatching)
tiffFile1.SaveChanges()
End Using
TiffTag class
TiffTag class allows to:
Here is C#/VB.NET code that shows how to add/modify data of the DateTime tag of the first page of TIFF file:
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile1 =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif");
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag dateTimeTag =
tiffFile1.Pages[0].IFD.Tags.Find(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime);
if (dateTimeTag != null)
dateTimeTag.Data = "01/09/2013 11:45:51";
else
tiffFile1.Pages[0].IFD.Tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "01/09/2013 11:45:51");
tiffFile1.SaveChanges();
Dim tiffFile1 As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("multipage.tif")
Dim dateTimeTag As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag = tiffFile1.Pages(0).IFD.Tags.Find(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime)
If dateTimeTag IsNot Nothing Then
dateTimeTag.Data = "01/09/2013 11:45:51"
Else
tiffFile1.Pages(0).IFD.Tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "01/09/2013 11:45:51")
End If
tiffFile1.SaveChanges()