TiffOptions
Contents
[
Hide
]TiffOptions constructor (1 of 4)
Initializes a new instance of the TiffOptions
class.
public TiffOptions(TiffExpectedFormat expectedFormat, TiffByteOrder byteOrder)
Parameter | Type | Description |
---|---|---|
expectedFormat | TiffExpectedFormat | The expected tiff file format. |
byteOrder | TiffByteOrder | The tiff file format byte order to use. |
See Also
- enum TiffExpectedFormat
- enum TiffByteOrder
- class TiffOptions
- namespace Aspose.Imaging.ImageOptions
- assembly Aspose.Imaging
TiffOptions constructor (2 of 4)
Initializes a new instance of the TiffOptions
class. By default little endian convention is used.
public TiffOptions(TiffExpectedFormat expectedFormat)
Parameter | Type | Description |
---|---|---|
expectedFormat | TiffExpectedFormat | The expected tiff file format. |
Examples
The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.
[C#]
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Create a permanent, not temporary file source.
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// The linear gradient from the left-top to the right-bottom corner of the image.
Aspose.Imaging.Brushes.LinearGradientBrush brush =
new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green);
// Fill the active frame with a linear gradient brush.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
gr.FillRectangle(brush, tiffImage.Bounds);
// Grayscale options
Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
// Create a grayscale copy of the active frame.
// The pixel data is preserved but converted to the desired format.
Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
// Add the newly created frame to the TIFF image.
tiffImage.AddFrame(grayscaleFrame);
tiffImage.Save();
}
This example shows how to save a raster image to the TIFF format using various options.
[C#]
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Allow to reduce the size of continuous-tone images.
// Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
// that benefits significantly from a predictor step.
saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
// Set the RGB color model.
saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// For YCbCr, you can use one of the following choices:
// YCbCrSubSampling field JPEG sampling factors
// ----------------------------------------------
// 1,1 1x1, 1x1, 1x1
// 2,1 2x1, 1x1, 1x1
// 2,2(default value) 2x2, 1x1, 1x1
// saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };
// All color components will be stored within a singel plane.
saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create a TIFF Frame of 100x100 px.
using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
{
// Fill the entire image with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(image.Width, image.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
graphics.FillRectangle(gradientBrush, image.Bounds);
image.Save(dir + "output.tif", saveOptions);
}
See Also
- enum TiffExpectedFormat
- class TiffOptions
- namespace Aspose.Imaging.ImageOptions
- assembly Aspose.Imaging
TiffOptions constructor (3 of 4)
Initializes a new instance of the TiffOptions
class.
public TiffOptions(TiffOptions options)
Parameter | Type | Description |
---|---|---|
options | TiffOptions | The options to copy from. |
See Also
- class TiffOptions
- namespace Aspose.Imaging.ImageOptions
- assembly Aspose.Imaging
TiffOptions constructor (4 of 4)
Initializes a new instance of the TiffOptions
class.
public TiffOptions(TiffDataType[] tags)
Parameter | Type | Description |
---|---|---|
tags | TiffDataType[] | The tags to initialize options with. |
See Also
- class TiffDataType
- class TiffOptions
- namespace Aspose.Imaging.ImageOptions
- assembly Aspose.Imaging