Edit

Share via


TiffBitmapEncoder.Compression Property

Definition

Gets or sets a value that indicates the type of compression that is used by this Tagged Image File Format (TIFF) image.

public:
 property System::Windows::Media::Imaging::TiffCompressOption Compression { System::Windows::Media::Imaging::TiffCompressOption get(); void set(System::Windows::Media::Imaging::TiffCompressOption value); };
public System.Windows.Media.Imaging.TiffCompressOption Compression { get; set; }
member this.Compression : System.Windows.Media.Imaging.TiffCompressOption with get, set
Public Property Compression As TiffCompressOption

Property Value

One of the TiffCompressOption values. The default is Default.

Examples

The following example demonstrates how to use the Compression property.

FileStream^ stream = gcnew FileStream("new.tif", FileMode::Create);
TiffBitmapEncoder^ encoder = gcnew TiffBitmapEncoder();
TextBlock^ myTextBlock = gcnew TextBlock();
myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString();
encoder->Compression = TiffCompressOption::Zip;
encoder->Frames->Add(BitmapFrame::Create(image));
encoder->Save(stream);
var stream = new FileStream("new.tif", FileMode.Create);
var encoder = new TiffBitmapEncoder();
var myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Compression = TiffCompressOption.Zip;
encoder.Frames.Add(BitmapFrame.Create(image));
encoder.Save(stream);
Dim stream As New FileStream("new.tif", FileMode.Create)
Dim encoder As New TiffBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.Compression = TiffCompressOption.Zip
encoder.Frames.Add(BitmapFrame.Create(image))
encoder.Save(stream)

Remarks

The Ccitt3, Ccitt4, and Rle values require that the PixelFormat value be set to PixelFormats.BlackWhite.

Applies to