This documentation is for the old version. Go to the latest Graphics Mill docs

TiffFrame Class

This class represents a frame of the TIFF format.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public NotInheritable Class TiffFrame _
	Inherits Frame
C#
public sealed class TiffFrame : Frame

Examples

You can use TiffWriter class instead of the Save(String, IEncoderOptions) method of the Bitmap. In particular it enables you to save the image asynchronously.

The TiffWriter class usage is demonstrated below:

Visual Basic
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()
C#
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);
            }
        }
    }
}

To load the TIFF files that contains multiple frames, you should use a TiffReader class. The code below demonstrates its usage. It reads multipage TIFF file and save each page into the separate JPEG file.

Visual Basic
Dim filename As String = "c:\multipage.tif"

Dim reader As Aurigma.GraphicsMill.Codecs.FormatReader = _
 Aurigma.GraphicsMill.Codecs.FormatManager.CreateFormatReader(filename)

Dim bitmap As New Aurigma.GraphicsMill.Bitmap

For i As Integer = 0 To reader.FrameCount - 1
    Dim frame As Aurigma.GraphicsMill.Codecs.Frame = reader.LoadFrame(i)
    frame.GetBitmap(bitmap)
    frame.Dispose()

    bitmap.Save("c:\frame_" & i & ".jpg")
Next

bitmap.Dispose()

reader.Dispose()
C#
string filename = @"c:\multipage.tif";

using (Aurigma.GraphicsMill.Codecs.IFormatReader reader =
           Aurigma.GraphicsMill.Codecs.FormatManager.CreateFormatReader(filename))
{

    using (Aurigma.GraphicsMill.Bitmap bitmap =
               new Aurigma.GraphicsMill.Bitmap())
    {
        for (int i = 0; i < reader.FrameCount - 1; i++)
        {
            using (Aurigma.GraphicsMill.Codecs.IFrame frame =
                       reader.LoadFrame(i))
            {
                frame.GetBitmap(bitmap);
                bitmap.Save(@"c:\frame_" + i.ToString() + ".jpg");
            }
        }
    }
}

Inheritance Hierarchy

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





See Also

Reference