---
title: "TiffWriter Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_TiffWriter.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# TiffWriter Class
 
This class enables you to write TIFF images.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class TiffWriter _Inherits FormatWriter _Implements IMetadataWriteSupport
```
 
```csharp
public sealed class TiffWriter : FormatWriter, IMetadataWriteSupport
```
 
## Remarks
  
TIFF format is one of the most comprehensive image formats. It was designed to promote the interchange of digital image data. The general scenario TIFF format was invented for, assumes that scanning or painting software creates a TIFF file, which can then be read and incorporated into a document or publication by an application such as a desktop publishing package. It is also widely used to retrieve facsimile messages.
 
This image format is rather versatile and have a lot of modifications. It supports most Graphics Mill for .NET pixel formats even such exotic ones like [Format80bppAcmyk](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_PixelFormat.htm.md). It also can store multiple images in the single file (mostly used for fax images and other documents stored as 1-bit bitmaps).
 
TIFF files can also contain Adobe® resources, XMP, EXIF and IPTC data.
 
## Examples
  
You can use TiffWriter class instead of the [Save(String, IEncoderOptions)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Save_2_b73a8298.htm.md) method of the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md). In particular it enables you to save the image asynchronously.
 
The TiffWriter class usage is demonstrated below:
 
```
Dim dir As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\"
Dim images As String() = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"}

Dim bitmap As New Aurigma.GraphicsMill.Bitmap

Dim writer As New Aurigma.GraphicsMill.Codecs.TiffWriter("C:\multipage.tif")

For Each image As String In images
    bitmap.Load(dir & image)

    Dim frame As New Aurigma.GraphicsMill.Codecs.TiffFrame
    frame.Compression = Aurigma.GraphicsMill.Codecs.CompressionType.Lzw
    frame.SetBitmap(bitmap)

    writer.AddFrame(frame)

    frame.Dispose()
Next

bitmap.Dispose()

writer.Dispose()
```
 
```csharp
string dir = @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\";
String[] images = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"};

using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap())
{
    using(Aurigma.GraphicsMill.Codecs.TiffWriter writer =
              new Aurigma.GraphicsMill.Codecs.TiffWriter(@"C:\multipage.tif"))
    {
        foreach (string image in images)
        {
            bitmap.Load(dir + image);

            using (Aurigma.GraphicsMill.Codecs.TiffFrame frame =
                       new Aurigma.GraphicsMill.Codecs.TiffFrame())
            {
                frame.Compression = Aurigma.GraphicsMill.Codecs.CompressionType.Lzw;
                frame.SetBitmap(bitmap);
                writer.AddFrame(frame);
            }
        }
    }
}
```
 
TIFF files can store EXIF and IPTC data blocks. Graphics Mill for .NET allows you extracting this data from the TIFF file and save it into another TIFF file (as well as into the other file format which supports EXIF and IPTC). This code sample demonstrates how to add the EXIF and IPTC data to the file:
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg")
Dim writer As New Aurigma.GraphicsMill.Codecs.TiffWriter("C:\Mountain.tif")

'EXIF
Dim exif As New Aurigma.GraphicsMill.Codecs.ExifDictionary
exif(Aurigma.GraphicsMill.Codecs.ExifDictionary.Software) = "Aurigma Graphics Mill"

writer.Exif = exif

'IPTC
Dim iptc As New Aurigma.GraphicsMill.Codecs.IptcDictionary
iptc(Aurigma.GraphicsMill.Codecs.IptcDictionary.Category) = "Nature"
iptc(Aurigma.GraphicsMill.Codecs.IptcDictionary.CopyrightNotice) = "Aurigma Inc."
iptc(Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword) = "mountain"

writer.Iptc = iptc

'Adobe resource blocks
Dim adobeResources As New Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary
'Create new adobe image resource block with the required metadata
Dim arBlock As New Aurigma.GraphicsMill.Codecs.AdobeResourceBlock("Copyright", New Byte() {1})
'Set this block to the item with 0x040A ID (copyright flag)
adobeResources.Item(&H40A) = arBlock

writer.AdobeResources = adobeResources

'XMP
Dim xmp As New Aurigma.GraphicsMill.Codecs.XmpData()
'Create a node with the required metadata
Dim node As New Aurigma.GraphicsMill.Codecs.XmpValueNode( _
    Aurigma.GraphicsMill.Codecs.XmpNodeType.SimpleProperty, _
    "John Doe", _
    Aurigma.GraphicsMill.Codecs.XmpTagNames.DCCreator)
xmp.AddNode(node)

writer.Xmp = xmp.Save()

Dim frame As New Aurigma.GraphicsMill.Codecs.TiffFrame(50)

frame.SetBitmap(bitmap)

bitmap.Dispose()

writer.AddFrame(frame)

frame.Dispose()

writer.Dispose()
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg"))
{                
    using (Aurigma.GraphicsMill.Codecs.TiffWriter writer = 
               new Aurigma.GraphicsMill.Codecs.TiffWriter(@"C:\Mountain.tif"))
    {
        //EXIF
        Aurigma.GraphicsMill.Codecs.ExifDictionary exif =
            new Aurigma.GraphicsMill.Codecs.ExifDictionary();
        exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Software] = "Aurigma Graphics Mill";

        writer.Exif = exif;
    
        //IPTC
        Aurigma.GraphicsMill.Codecs.IptcDictionary iptc =
            new Aurigma.GraphicsMill.Codecs.IptcDictionary();
        iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Category] = "Nature";
        iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.CopyrightNotice] = "Aurigma Inc.";
        iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword] = "mountain";

        writer.Iptc = iptc;

        //Adobe resource blocks
        Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary adobeResources =
            new Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary();
        //Create new adobe image resource block with the required metadata
        Aurigma.GraphicsMill.Codecs.AdobeResourceBlock arBlock = new
            Aurigma.GraphicsMill.Codecs.AdobeResourceBlock("Copyright", new byte[] { 1 });
        //Set this block to the item with 0x040A ID (copyright flag)
        adobeResources[0x040A] = arBlock;

        writer.AdobeResources = adobeResources;

        //XMP
        Aurigma.GraphicsMill.Codecs.XmpData xmp = new Aurigma.GraphicsMill.Codecs.XmpData();
        //Create a node with the required metadata
        Aurigma.GraphicsMill.Codecs.XmpValueNode node = new
            Aurigma.GraphicsMill.Codecs.XmpValueNode(
                Aurigma.GraphicsMill.Codecs.XmpNodeType.SimpleProperty,
                "John Doe",
                Aurigma.GraphicsMill.Codecs.XmpTagNames.DCCreator);
        xmp.AddNode(node);

        writer.Xmp = xmp.Save();

        using (Aurigma.GraphicsMill.Codecs.TiffFrame frame = 
                   new Aurigma.GraphicsMill.Codecs.TiffFrame(50))
        {
            frame.SetBitmap(bitmap);

            writer.AddFrame(frame);
        }
    }
}
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.SyncHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_SyncHandler.htm.md)
        - [Aurigma.GraphicsMill.Codecs.FormatWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_FormatWriter.htm.md)
            - Aurigma.GraphicsMill.Codecs.TiffWriter
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_191.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_TiffWriter.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_4.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AdobeResourceDictionary.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_5.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_ExifDictionary.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_107.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IEncoderOptions.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_108.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFrame.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_6.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IptcDictionary.htm.md)
 
## Supported Pixel Formats

| Member Name | Description |
| --- | --- |
| **Format1bppIndexed** | 1 bit per pixel. Indexed. |
| **Format4bppIndexed** | 4 bits per pixel. Indexed. |
| **Format8bppIndexed** | 8 bits per pixel. Indexed. |
| **Format8bppGrayScale** | 8 bits per pixel. Grayscale. 8 bits are used for luminosity level. |
| **Format16bppGrayScale** | 16 bits per pixel. Grayscale. All 16 bits are used for luminosity level (extended pixel format). |
| **Format16bppAGrayScale** | 16 bits per pixel. Grayscale with alpha channel. 8 bits are used for alpha channel and other 8 bits are used for luminosity level. |
| **Format32bppAGrayScale** | 32 bits per pixel. Grayscale with alpha channel. 16 bits are used for alpha channel and other 16 bits are used for luminosity level (extended pixel format). |
| **Format24bppRgb** | 24 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. |
| **Format32bppRgb** | 32 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. The rest 8 bits are unused. |
| **Format32bppArgb** | 32 bits per pixel. RGB with alpha channel. 8 bits each are used for the alpha, red, green, and blue components. |
| **Format48bppRgb** | 48 bits per pixel. RGB. 16 bits each are used for the red, green, and blue components (extended pixel format). |
| **Format64bppArgb** | 64 bits per pixel. RGB with alpha channel. 16 bits each are used for the alpha, red, green, and blue components (extended pixel format). |
| **Format32bppCmyk** | 32 bits per pixel. CMYK. 8 bits each are used for the cyan, magenta, yellow, and black components. |
| **Format40bppAcmyk** | 40 bits per pixel. CMYK with alpha channel. 8 bits each are used for the alpha, cyan, magenta, yellow, and black components. |
| **Format64bppCmyk** | 64 bits per pixel. CMYK. 16 bits each are used for the cyan, magenta, yellow, and black components (extended pixel format). |
| **Format80bppAcmyk** | 80 bits per pixel. CMYK with alpha channel. 16 bits each are used for the alpha, cyan, magenta, yellow, and black components (extended pixel format). |
 
## See Also

### Reference

- [TiffWriter Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Codecs_TiffWriter.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
