TiffOptions

Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.ImageOptionsBase

All Implemented Interfaces: com.aspose.internal.IMetadataContainer

public class TiffOptions extends ImageOptionsBase implements IMetadataContainer

The tiff file format options. Note that width and height tags will get overwritten on image creation by width and height parameters so there is no need to specify them directly. Note that many options return a default value but that does not mean that this option is set explicitly as a tag value. To verify the tag is present use Tags property or the corresponding IsTagPresent method.

WARNING! never modify tiff options during save since this may cause side effects and hard to find bugs. The following line was specially left commented since it caused incorrect determination of data beginning. The passed options did not contain spp (although the options are not correct in such case but still this scenario causes errors) and the next line caused +spp tag +bpp tag added and when options were written after data completely written they have overwritten the data beginning for uncompressed codec!!! See TiffUncompressedCodec.Encode. this.Options.SamplesPerPixel = 3;

Constructors

ConstructorDescription
TiffOptions(int expectedFormat, int byteOrder)Initializes a new instance of the TiffOptions class.
TiffOptions(int expectedFormat)Initializes a new instance of the TiffOptions class.
TiffOptions(TiffOptions options)Initializes a new instance of the TiffOptions class.
TiffOptions(TiffDataType[] tags)Initializes a new instance of the TiffOptions class.

Methods

MethodDescription
getValidTagsCount(TiffDataType[] tags)Gets the valid tags count.
getTagCount()Gets the tag count.
getFileStandard()Gets or sets the TIFF file standard.
setFileStandard(int value)Gets or sets the TIFF file standard.
getDefaultMemoryAllocationLimit()Gets or sets the default memory allocation limit.
setDefaultMemoryAllocationLimit(int value)Gets or sets the default memory allocation limit.
getPremultiplyComponents()Gets or sets a value indicating whether components must be premultiplied.
setPremultiplyComponents(boolean value)Gets or sets a value indicating whether components must be premultiplied.
isValid()Gets a value indicating whether the TiffOptions have been properly configured.
getYCbCrSubsampling()Gets or sets the subsampling factors for YCbCr photometric.
setYCbCrSubsampling(int[] value)Gets or sets the subsampling factors for YCbCr photometric.
getYCbCrCoefficients()Gets or sets the YCbCrCoefficients.
setYCbCrCoefficients(TiffRational[] value)Gets or sets the YCbCrCoefficients.
isTiled()Gets a value indicating whether image is tiled.
getArtist()Gets or sets the artist.
setArtist(String value)Gets or sets the artist.
isTagPresent(int tag)Determines whether tag is present in the options or not.
getByteOrder()Gets or sets a value indicating the tiff byte order.
setByteOrder(int value)Gets or sets a value indicating the tiff byte order.
getIccProfile()Gets the icc profile stream.
setIccProfile(byte[] value)Sets the icc profile stream.
isDisableIccExport()Gets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).
setDisableIccExport(boolean value)Sets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).
getBitsPerSample()Gets the bits per sample.
setBitsPerSample(int[] value)Sets the bits per sample.
getExtraSamples()Gets the extra samples values.
getCompression()Gets the compression.
setCompression(int value)Sets the compression.
getCompressedQuality()Gets compressed image quality.
setCompressedQuality(int value)Sets compressed image quality.
getCopyright()Gets the copyright.
setCopyright(String value)Sets the copyright.
getColorMap()Gets or sets the color map.
setColorMap(int[] value)Gets or sets the color map.
getPalette()Gets or sets the color palette.
setPalette(IColorPalette value)Gets or sets the color palette.
getDateTime()Gets or sets the date and time.
setDateTime(String value)Gets or sets the date and time.
getDocumentName()Gets or sets the name of the document.
setDocumentName(String value)Gets or sets the name of the document.
getAlphaStorage()Gets or sets the alpha storage option.
setAlphaStorage(int value)Gets or sets the alpha storage option.
isExtraSamplesPresent()Gets a value indicating whether the extra samples is present.
getFillOrder()Gets or sets the byte bits fill order.
setFillOrder(int value)Gets or sets the byte bits fill order.
getHalfToneHints()Gets or sets the halftone hints.
setHalfToneHints(int[] value)Gets or sets the halftone hints.
getImageDescription()Gets or sets the image description.
setImageDescription(String value)Gets or sets the image description.
getInkNames()Gets or sets the ink names.
setInkNames(String value)Gets or sets the ink names.
getScannerManufacturer()Gets or sets the scanner manufacturer.
setScannerManufacturer(String value)Gets or sets the scanner manufacturer.
getMaxSampleValue()Gets or sets the max sample value.
setMaxSampleValue(int[] value)Gets or sets the max sample value.
getMinSampleValue()Gets or sets the min sample value.
setMinSampleValue(int[] value)Gets or sets the min sample value.
getScannerModel()Gets or sets the scanner model.
setScannerModel(String value)Gets or sets the scanner model.
getOrientation()Gets or sets the orientation.
setOrientation(int value)Gets or sets the orientation.
getPageName()Gets or sets the page name.
setPageName(String value)Gets or sets the page name.
getPageNumber()Gets or sets the page number tag.
setPageNumber(int[] value)Gets or sets the page number tag.
getPhotometric()Gets or sets the photometric.
setPhotometric(int value)Gets or sets the photometric.
getPlanarConfiguration()Gets or sets the planar configuration.
setPlanarConfiguration(int value)Gets or sets the planar configuration.
getResolutionUnit()Gets or sets the resolution unit.
setResolutionUnit(int value)Gets or sets the resolution unit.
getRowsPerStrip()Gets or sets the rows per strip.
setRowsPerStrip(long value)Gets or sets the rows per strip.
getTileWidth()Gets ot sets tile width.
setTileWidth(long value)Gets ot sets tile width.
getTileLength()Gets ot sets tile length.
setTileLength(long value)Gets ot sets tile length.
getSampleFormat()Gets or sets the sample format.
setSampleFormat(int[] value)Gets or sets the sample format.
getSamplesPerPixel()Gets the samples per pixel.
getSmaxSampleValue()Gets or sets the max sample value.
setSmaxSampleValue(long[] value)Gets or sets the max sample value.
getSminSampleValue()Gets or sets the min sample value.
setSminSampleValue(long[] value)Gets or sets the min sample value.
getSoftwareType()Gets or sets the software type.
setSoftwareType(String value)Gets or sets the software type.
getStripByteCounts()Gets or sets the strip byte counts.
setStripByteCounts(long[] value)Gets or sets the strip byte counts.
getStripOffsets()Gets or sets the strip offsets.
setStripOffsets(long[] value)Gets or sets the strip offsets.
getTileByteCounts()Gets or sets the tile byte counts.
setTileByteCounts(long[] value)Gets or sets the tile byte counts.
getTileOffsets()Gets or sets the tile offsets.
setTileOffsets(long[] value)Gets or sets the tile offsets.
getSubFileType()Gets or sets a general indication of the kind of data contained in this subfile.
setSubFileType(long value)Gets or sets a general indication of the kind of data contained in this subfile.
getTargetPrinter()Gets or sets the target printer.
setTargetPrinter(String value)Gets or sets the target printer.
getThreshholding()Gets or sets the threshholding.
setThreshholding(int value)Gets or sets the threshholding.
getTotalPages()Gets the total pages.
getXposition()Gets or sets the x position.
setXposition(TiffRational value)Gets or sets the x position.
getResolutionSettings()Gets or sets the resolution settings.
setResolutionSettings(ResolutionSetting value)Gets or sets the resolution settings.
getXresolution()Gets or sets the x resolution.
setXresolution(TiffRational value)Gets or sets the x resolution.
getYposition()Gets or sets the y position.
setYposition(TiffRational value)Gets or sets the y position.
getYresolution()Gets or sets the y resolution.
setYresolution(TiffRational value)Gets or sets the y resolution.
getFaxT4Options()Gets or sets the fax t4 options.
setFaxT4Options(long value)Gets or sets the fax t4 options.
getPredictor()Gets or sets the predictor for LZW compression.
setPredictor(int value)Gets or sets the predictor for LZW compression.
getImageLength()Gets or sets the image length.
setImageLength(long value)Gets or sets the image length.
getImageWidth()Gets or sets the image width.
setImageWidth(long value)Gets or sets the image width.
getExifIfd()Gets or sets the pointer to EXIF IFD.
getTags()Gets or sets the tags.
setTags(TiffDataType[] value)Gets or sets the tags.
getValidTagCount()Gets the valid tag count.
getBitsPerPixel()Gets the bits per pixel.
getXPTitle()Gets information about image, which used by Windows Explorer.
setXPTitle(String value)Sets information about image, which used by Windows Explorer.
getXPComment()Gets comment on image, which used by Windows Explorer.
setXPComment(String value)Sets comment on image, which used by Windows Explorer.
getXPAuthor()Gets image author, which used by Windows Explorer.
setXPAuthor(String value)Sets image author, which used by Windows Explorer.
getXPKeywords()Gets subject image, which used by Windows Explorer.
setXPKeywords(String value)Sets subject image, which used by Windows Explorer.
getXPSubject()Gets information about image, which used by Windows Explorer.
setXPSubject(String value)Sets information about image, which used by Windows Explorer.
getExifData()Gets Exif data.
setExifData(ExifData value)Sets Exif data.
removeTag(int tag)Removes the tag.
removeTags(int[] tags)Removes the tags.
validate()Validates if options have valid combination of tags
addTags(TiffDataType[] tagsToAdd)Adds the tags.
addTag(TiffDataType tagToAdd)Adds a new tag.
getTagByType(int tagKey)Gets the instance of the tag by type.

Example: This example demonstrates the use of different classes from SaveOptions Namespace for export purposes.

This example demonstrates the use of different classes from SaveOptions Namespace for export purposes. An image of type Gif is loaded into an instance of Image and then exported out to several formats.

String dir = "c:\\temp\\";

//Load an existing image (of type Gif) in an instance of Image class
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.gif");
try {
    //Export to BMP file format using the default options
    image.save(dir + "output.bmp", new com.aspose.imaging.imageoptions.BmpOptions());

    //Export to JPEG file format using the default options
    image.save(dir + "output.jpeg", new com.aspose.imaging.imageoptions.JpegOptions());

    //Export to PNG file format using the default options
    image.save(dir + "output.png", new com.aspose.imaging.imageoptions.PngOptions());

    //Export to TIFF file format using the default options
    image.save(dir + "output.tif", new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default));
} finally {
    image.dispose();
}

Example: The following example shows how to convert a multipage vector image to TIFF format in general way without referencing to a particular image type.

String dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548\\";
String inputFilePath = dir + "Multipage.cdr";
String outputFilePath = dir + "Multipage.cdr.tiff";

com.aspose.imaging.ImageOptionsBase exportOptions = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath))
{
    exportOptions.setMultiPageOptions(null);

    // Export only first two pages. These pages will be presented as frames in the output TIFF.
    com.aspose.imaging.IMultipageImage multipageImage = (image instanceof com.aspose.imaging.IMultipageImage) ? (com.aspose.imaging.IMultipageImage) image : null;
    if (multipageImage != null && (multipageImage.getPages() != null && multipageImage.getPageCount() > 2))
    {
        exportOptions.setMultiPageOptions(new com.aspose.imaging.imageoptions.MultiPageOptions(new com.aspose.imaging.IntRange(0, 2)));
    }

    if (image instanceof com.aspose.imaging.VectorImage)
    {
        com.aspose.imaging.imageoptions.VectorRasterizationOptions defaultOptions = (com.aspose.imaging.imageoptions.VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()});
        exportOptions.setVectorRasterizationOptions(defaultOptions);
        defaultOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.SingleBitPerPixel);
        defaultOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.None);
    }

    image.save(outputFilePath, exportOptions);
}

TiffOptions(int expectedFormat, int byteOrder)

public TiffOptions(int expectedFormat, int byteOrder)

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
expectedFormatintThe expected tiff file format.
byteOrderintThe tiff file format byte order.

TiffOptions(int expectedFormat)

public TiffOptions(int expectedFormat)

Initializes a new instance of the TiffOptions class. By default little endian convention is used.

Parameters:

ParameterTypeDescription
expectedFormatintThe expected tiff file format.

TiffOptions(TiffOptions options)

public TiffOptions(TiffOptions options)

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
optionsTiffOptionsThe options to copy from.

TiffOptions(TiffDataType[] tags)

public TiffOptions(TiffDataType[] tags)

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
tagsTiffDataType[]The tags to initialize options with.

getValidTagsCount(TiffDataType[] tags)

public static int getValidTagsCount(TiffDataType[] tags)

Gets the valid tags count.

Parameters:

ParameterTypeDescription
tagsTiffDataType[]The tags to validate.

Returns: int - The valid tags count.

getTagCount()

public final int getTagCount()

Gets the tag count.

Returns: int - the tag count.

getFileStandard()

public int getFileStandard()

Gets or sets the TIFF file standard.

Returns: int - The TIFF file standard.

setFileStandard(int value)

public void setFileStandard(int value)

Gets or sets the TIFF file standard.

Parameters:

ParameterTypeDescription
valueintThe TIFF file standard.

getDefaultMemoryAllocationLimit()

public int getDefaultMemoryAllocationLimit()

Gets or sets the default memory allocation limit.

Returns: int - The default memory allocation limit.

setDefaultMemoryAllocationLimit(int value)

public void setDefaultMemoryAllocationLimit(int value)

Gets or sets the default memory allocation limit.

Parameters:

ParameterTypeDescription
valueintThe default memory allocation limit.

getPremultiplyComponents()

public boolean getPremultiplyComponents()

Gets or sets a value indicating whether components must be premultiplied.

Returns: boolean - true if components must be premultiplied; otherwise, false.

setPremultiplyComponents(boolean value)

public void setPremultiplyComponents(boolean value)

Gets or sets a value indicating whether components must be premultiplied.

Parameters:

ParameterTypeDescription
valuebooleantrue if components must be premultiplied; otherwise, false.

isValid()

public boolean isValid()

Gets a value indicating whether the TiffOptions have been properly configured. Use Validate method as to find the failure reason.

Returns: boolean - true if TiffOptions are properly configured; otherwise, false.

getYCbCrSubsampling()

public int[] getYCbCrSubsampling()

Gets or sets the subsampling factors for YCbCr photometric.

Returns: int[] - The subsampling factors for YCbCr photometric.

setYCbCrSubsampling(int[] value)

public void setYCbCrSubsampling(int[] value)

Gets or sets the subsampling factors for YCbCr photometric.

Parameters:

ParameterTypeDescription
valueint[]The subsampling factors for YCbCr photometric.

Example: This example shows how to save a raster image to the TIFF format using various options.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions saveOptions
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 8 bits for each color component.
saveOptions.setBitsPerSample(new int[]{8, 8, 8});

// Set the Big Endian byte order (Motorola)
saveOptions.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.BigEndian);

// Set the LZW compression.
saveOptions.setCompression(com.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.setPredictor(com.aspose.imaging.fileformats.tiff.enums.TiffPredictor.Horizontal);

// Set the RGB color model.
saveOptions.setPhotometric(com.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 single plane.
saveOptions.setPlanarConfiguration(com.aspose.imaging.fileformats.tiff.enums.TiffPlanarConfigs.Contiguous);

// Create a TIFF Frame of 100x100 px.
com.aspose.imaging.Image image = new com.aspose.imaging.fileformats.bmp.BmpImage(100, 100);
try {
    // Fill the entire image with the blue-yellow gradient.
    com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush(
            new com.aspose.imaging.Point(0, 0),
            new com.aspose.imaging.Point(image.getWidth(), image.getHeight()),
            com.aspose.imaging.Color.getBlue(),
            com.aspose.imaging.Color.getYellow());

    com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(image);
    graphics.fillRectangle(gradientBrush, image.getBounds());

    image.save(dir + "output.tif", saveOptions);
} finally {
    image.dispose();
}

getYCbCrCoefficients()

public TiffRational[] getYCbCrCoefficients()

Gets or sets the YCbCrCoefficients.

Returns: com.aspose.imaging.fileformats.tiff.TiffRational[] - The YCbCrCoefficients.

setYCbCrCoefficients(TiffRational[] value)

public void setYCbCrCoefficients(TiffRational[] value)

Gets or sets the YCbCrCoefficients.

Parameters:

ParameterTypeDescription
valueTiffRational[]The YCbCrCoefficients.

isTiled()

public boolean isTiled()

Gets a value indicating whether image is tiled.

Returns: boolean - true if image is tiled; otherwise, false.

getArtist()

public String getArtist()

Gets or sets the artist.

Returns: java.lang.String - The artist.

setArtist(String value)

public void setArtist(String value)

Gets or sets the artist.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe artist.

isTagPresent(int tag)

public boolean isTagPresent(int tag)

Determines whether tag is present in the options or not.

Parameters:

ParameterTypeDescription
tagintThe tag id to check.

Returns: boolean - true if tag is present; otherwise, false.

getByteOrder()

public int getByteOrder()

Gets or sets a value indicating the tiff byte order.

Returns: int

setByteOrder(int value)

public void setByteOrder(int value)

Gets or sets a value indicating the tiff byte order.

Parameters:

ParameterTypeDescription
valueint

Example: This example shows how to save a raster image to the TIFF format using various options.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions saveOptions
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 8 bits for each color component.
saveOptions.setBitsPerSample(new int[]{8, 8, 8});

// Set the Big Endian byte order (Motorola)
saveOptions.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.BigEndian);

// Set the LZW compression.
saveOptions.setCompression(com.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.setPredictor(com.aspose.imaging.fileformats.tiff.enums.TiffPredictor.Horizontal);

// Set the RGB color model.
saveOptions.setPhotometric(com.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 single plane.
saveOptions.setPlanarConfiguration(com.aspose.imaging.fileformats.tiff.enums.TiffPlanarConfigs.Contiguous);

// Create a TIFF Frame of 100x100 px.
com.aspose.imaging.Image image = new com.aspose.imaging.fileformats.bmp.BmpImage(100, 100);
try {
    // Fill the entire image with the blue-yellow gradient.
    com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush(
            new com.aspose.imaging.Point(0, 0),
            new com.aspose.imaging.Point(image.getWidth(), image.getHeight()),
            com.aspose.imaging.Color.getBlue(),
            com.aspose.imaging.Color.getYellow());

    com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(image);
    graphics.fillRectangle(gradientBrush, image.getBounds());

    image.save(dir + "output.tif", saveOptions);
} finally {
    image.dispose();
}

getIccProfile()

public byte[] getIccProfile()

Gets the icc profile stream.

Returns: byte[] - The icc profile.

setIccProfile(byte[] value)

public void setIccProfile(byte[] value)

Sets the icc profile stream.

Parameters:

ParameterTypeDescription
valuebyte[]The icc profile.

isDisableIccExport()

public final boolean isDisableIccExport()

Gets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).

Returns: boolean - a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).

setDisableIccExport(boolean value)

public final void setDisableIccExport(boolean value)

Sets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).

Parameters:

ParameterTypeDescription
valuebooleana value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).

getBitsPerSample()

public int[] getBitsPerSample()

Gets the bits per sample.

Returns: int[] - The bits per sample value.

When setting this value keep in mind that it will also set SamplesPerPixel value to array length. These 2 properties are very tightly coupled so may be set altogether only.

setBitsPerSample(int[] value)

public void setBitsPerSample(int[] value)

Sets the bits per sample.

Parameters:

ParameterTypeDescription
valueint[]The bits per sample value.

When setting this value keep in mind that it will also set SamplesPerPixel value to array length. These 2 properties are very tightly coupled so may be set altogether only. |

Example: The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions createTiffOptions
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Create a permanent, not temporary file source.
createTiffOptions.setSource(new com.aspose.imaging.sources.FileCreateSource(dir + "multipage.tif", false));
createTiffOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.Rgb);
createTiffOptions.setBitsPerSample(new int[]{8, 8, 8});

com.aspose.imaging.fileformats.tiff.TiffImage tiffImage = (com.aspose.imaging.fileformats.tiff.TiffImage) com.aspose.imaging.Image.create(createTiffOptions, 100, 100);
try {
    // The linear gradient from the left-top to the right-bottom corner of the image.
    com.aspose.imaging.brushes.LinearGradientBrush brush =
            new com.aspose.imaging.brushes.LinearGradientBrush(
                    new com.aspose.imaging.Point(0, 0),
                    new com.aspose.imaging.Point(tiffImage.getWidth(), tiffImage.getHeight()),
                    com.aspose.imaging.Color.getRed(),
                    com.aspose.imaging.Color.getGreen());

    // Fill the active frame with a linear gradient brush.
    com.aspose.imaging.Graphics gr = new com.aspose.imaging.Graphics(tiffImage.getActiveFrame());
    gr.fillRectangle(brush, tiffImage.getBounds());

    // Grayscale options
    com.aspose.imaging.imageoptions.TiffOptions createTiffFrameOptions
            = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);
    createTiffFrameOptions.setSource(new com.aspose.imaging.sources.StreamSource(new java.io.ByteArrayInputStream(new byte[0])));
    createTiffFrameOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.MinIsBlack);
    createTiffFrameOptions.setBitsPerSample(new int[]{8});

    // Create a grayscale copy of the active frame.
    // The pixel data is preserved but converted to the desired format.
    com.aspose.imaging.fileformats.tiff.TiffFrame grayscaleFrame
            = com.aspose.imaging.fileformats.tiff.TiffFrame.createFrameFrom(tiffImage.getActiveFrame(), createTiffFrameOptions);

    // Add the newly created frame to the TIFF image.
    tiffImage.addFrame(grayscaleFrame);

    tiffImage.save();
} finally {
    tiffImage.dispose();
}

getExtraSamples()

public final int[] getExtraSamples()

Gets the extra samples values.

Value: The extra samples value.

Returns: int[] - the extra samples values.

getCompression()

public int getCompression()

Gets the compression.

Returns: int - The compression.

setCompression(int value)

public void setCompression(int value)

Sets the compression.

Parameters:

ParameterTypeDescription
valueintThe compression.

Example: This example shows how to create a TIFF image with 2 frames and save it to a file.

String dir = "c:\\temp\\";

// Options for the first frame
com.aspose.imaging.imageoptions.TiffOptions createOptions1 =
        new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 8 bits for each color component.
createOptions1.setBitsPerSample(new int[]{8, 8, 8});

// Set the Big Endian byte order (Motorola)
createOptions1.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.BigEndian);

// Set the LZW compression.
createOptions1.setCompression(com.aspose.imaging.fileformats.tiff.enums.TiffCompressions.Lzw);

// Set the RGB color model.
createOptions1.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.Rgb);

// All color components will be stored within a single plane.
createOptions1.setPlanarConfiguration(com.aspose.imaging.fileformats.tiff.enums.TiffPlanarConfigs.Contiguous);

// Create the first TIFF frame of 100x100 px.
// Note that you don't have to dispose frames explicitly if they are included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
com.aspose.imaging.fileformats.tiff.TiffFrame frame1 = new com.aspose.imaging.fileformats.tiff.TiffFrame(createOptions1, 100, 100);

// Fill the first frame with the blue-yellow gradient.
com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush(
        new com.aspose.imaging.Point(0, 0),
        new com.aspose.imaging.Point(frame1.getWidth(), frame1.getHeight()),
        com.aspose.imaging.Color.getBlue(),
        com.aspose.imaging.Color.getYellow());

com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(frame1);
graphics.fillRectangle(gradientBrush, frame1.getBounds());

// Options for the first frame
com.aspose.imaging.imageoptions.TiffOptions createOptions2
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 1 bit per pixel for a B/W image.
createOptions2.setBitsPerSample(new int[]{1});

// Set the Little Endian byte order (Intel)
createOptions2.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.LittleEndian);

// Set the CCITT Group 3 Fax compression.
createOptions2.setCompression(com.aspose.imaging.fileformats.tiff.enums.TiffCompressions.CcittFax3);

// Set the B/W color model where 0 is black, 1 is white.
createOptions2.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.MinIsBlack);

// Create the second TIFF frame of 200x200px.
com.aspose.imaging.fileformats.tiff.TiffFrame frame2 = new com.aspose.imaging.fileformats.tiff.TiffFrame(createOptions2, 200, 200);

// Fill the second frame with the blue-yellow gradient.
// It will be automatically converted to the B/W format due to the corresponding settings of the frame.
com.aspose.imaging.Graphics graphics2 = new com.aspose.imaging.Graphics(frame2);
graphics2.fillRectangle(gradientBrush, frame2.getBounds());

// Create a TIFF image.
com.aspose.imaging.fileformats.tiff.TiffImage tiffImage = new com.aspose.imaging.fileformats.tiff.TiffImage(
        new com.aspose.imaging.fileformats.tiff.TiffFrame[]{frame1, frame2});
try {
    tiffImage.save(dir + "output.mutliframe.tif");
} finally {
    tiffImage.dispose();
}

getCompressedQuality()

public final int getCompressedQuality()

Gets compressed image quality. Used with the Jpeg compression.

Returns: int - compressed image quality.

setCompressedQuality(int value)

public final void setCompressedQuality(int value)

Sets compressed image quality. Used with the Jpeg compression.

Parameters:

ParameterTypeDescription
valueintcompressed image quality.

Example: This example shows how to create a TIFF image with the Jpeg compression and the specified compressed image quality.


try (com.aspose.imaging.fileformats.tiff.TiffImage image = (com.aspose.imaging.fileformats.tiff.TiffImage) com.aspose.imaging.Image.load("c:\\temp\\zeebra.tif"))
{
    com.aspose.imaging.imageoptions.TiffOptions tiffOptions = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);
    // Set the RGB color model.
    tiffOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.Rgb);
    // Set the Jpeg compression.
    tiffOptions.setCompression(com.aspose.imaging.fileformats.tiff.enums.TiffCompressions.Jpeg);
    tiffOptions.setCompressedQuality(50);
    // Set 8 bits for each color component.
    tiffOptions.setBitsPerSample(new int[]{8, 8, 8});

    image.save("zeebra.tif-50.tiff", tiffOptions);
}

getCopyright()

public String getCopyright()

Gets the copyright.

Returns: java.lang.String - The copyright.

setCopyright(String value)

public void setCopyright(String value)

Sets the copyright.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe copyright.

getColorMap()

public int[] getColorMap()

Gets or sets the color map.

Returns: int[] - The color map.

setColorMap(int[] value)

public void setColorMap(int[] value)

Gets or sets the color map.

Parameters:

ParameterTypeDescription
valueint[]The color map.

getPalette()

public IColorPalette getPalette()

Gets or sets the color palette.

Returns: IColorPalette - The color palette.

setPalette(IColorPalette value)

public void setPalette(IColorPalette value)

Gets or sets the color palette.

Parameters:

ParameterTypeDescription
valueIColorPaletteThe color palette.

getDateTime()

public String getDateTime()

Gets or sets the date and time.

Returns: java.lang.String - The date and time.

setDateTime(String value)

public void setDateTime(String value)

Gets or sets the date and time.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe date and time.

getDocumentName()

public String getDocumentName()

Gets or sets the name of the document.

Returns: java.lang.String - The name of the document.

setDocumentName(String value)

public void setDocumentName(String value)

Gets or sets the name of the document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe name of the document.

getAlphaStorage()

public int getAlphaStorage()

Gets or sets the alpha storage option. Options other than TiffAlphaStorage.Unspecified are used when there are more than 3 SamplesPerPixel defined.

Returns: int - The alpha storage option.

setAlphaStorage(int value)

public void setAlphaStorage(int value)

Gets or sets the alpha storage option. Options other than TiffAlphaStorage.Unspecified are used when there are more than 3 SamplesPerPixel defined.

Parameters:

ParameterTypeDescription
valueintThe alpha storage option.

isExtraSamplesPresent()

public boolean isExtraSamplesPresent()

Gets a value indicating whether the extra samples is present.

Returns: boolean - true if the extra samples is present; otherwise, false.

getFillOrder()

public int getFillOrder()

Gets or sets the byte bits fill order.

Returns: int - The byte bits fill order.

setFillOrder(int value)

public void setFillOrder(int value)

Gets or sets the byte bits fill order.

Parameters:

ParameterTypeDescription
valueintThe byte bits fill order.

getHalfToneHints()

public int[] getHalfToneHints()

Gets or sets the halftone hints.

Returns: int[] - The halftone hints.

setHalfToneHints(int[] value)

public void setHalfToneHints(int[] value)

Gets or sets the halftone hints.

Parameters:

ParameterTypeDescription
valueint[]The halftone hints.

getImageDescription()

public String getImageDescription()

Gets or sets the image description.

Returns: java.lang.String - The image description.

setImageDescription(String value)

public void setImageDescription(String value)

Gets or sets the image description.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe image description.

getInkNames()

public String getInkNames()

Gets or sets the ink names.

Returns: java.lang.String - The ink names.

setInkNames(String value)

public void setInkNames(String value)

Gets or sets the ink names.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe ink names.

getScannerManufacturer()

public String getScannerManufacturer()

Gets or sets the scanner manufacturer.

Returns: java.lang.String - The scanner manufacturer.

setScannerManufacturer(String value)

public void setScannerManufacturer(String value)

Gets or sets the scanner manufacturer.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe scanner manufacturer.

getMaxSampleValue()

public int[] getMaxSampleValue()

Gets or sets the max sample value.

Returns: int[] - The max sample value.

setMaxSampleValue(int[] value)

public void setMaxSampleValue(int[] value)

Gets or sets the max sample value.

Parameters:

ParameterTypeDescription
valueint[]The max sample value.

getMinSampleValue()

public int[] getMinSampleValue()

Gets or sets the min sample value.

Returns: int[] - The min sample value.

setMinSampleValue(int[] value)

public void setMinSampleValue(int[] value)

Gets or sets the min sample value.

Parameters:

ParameterTypeDescription
valueint[]The min sample value.

getScannerModel()

public String getScannerModel()

Gets or sets the scanner model.

Returns: java.lang.String - The scanner model.

setScannerModel(String value)

public void setScannerModel(String value)

Gets or sets the scanner model.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe scanner model.

getOrientation()

public int getOrientation()

Gets or sets the orientation.

Returns: int - The orientation.

setOrientation(int value)

public void setOrientation(int value)

Gets or sets the orientation.

Parameters:

ParameterTypeDescription
valueintThe orientation.

getPageName()

public String getPageName()

Gets or sets the page name.

Returns: java.lang.String - The page name.

setPageName(String value)

public void setPageName(String value)

Gets or sets the page name.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe page name.

getPageNumber()

public int[] getPageNumber()

Gets or sets the page number tag.

Returns: int[] - The page number tag.

setPageNumber(int[] value)

public void setPageNumber(int[] value)

Gets or sets the page number tag.

Parameters:

ParameterTypeDescription
valueint[]The page number tag.

getPhotometric()

public int getPhotometric()

Gets or sets the photometric.

Returns: int - The photometric.

setPhotometric(int value)

public void setPhotometric(int value)

Gets or sets the photometric.

Parameters:

ParameterTypeDescription
valueintThe photometric.

Example: The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions createTiffOptions
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Create a permanent, not temporary file source.
createTiffOptions.setSource(new com.aspose.imaging.sources.FileCreateSource(dir + "multipage.tif", false));
createTiffOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.Rgb);
createTiffOptions.setBitsPerSample(new int[]{8, 8, 8});

com.aspose.imaging.fileformats.tiff.TiffImage tiffImage = (com.aspose.imaging.fileformats.tiff.TiffImage) com.aspose.imaging.Image.create(createTiffOptions, 100, 100);
try {
    // The linear gradient from the left-top to the right-bottom corner of the image.
    com.aspose.imaging.brushes.LinearGradientBrush brush =
            new com.aspose.imaging.brushes.LinearGradientBrush(
                    new com.aspose.imaging.Point(0, 0),
                    new com.aspose.imaging.Point(tiffImage.getWidth(), tiffImage.getHeight()),
                    com.aspose.imaging.Color.getRed(),
                    com.aspose.imaging.Color.getGreen());

    // Fill the active frame with a linear gradient brush.
    com.aspose.imaging.Graphics gr = new com.aspose.imaging.Graphics(tiffImage.getActiveFrame());
    gr.fillRectangle(brush, tiffImage.getBounds());

    // Grayscale options
    com.aspose.imaging.imageoptions.TiffOptions createTiffFrameOptions
            = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);
    createTiffFrameOptions.setSource(new com.aspose.imaging.sources.StreamSource(new java.io.ByteArrayInputStream(new byte[0])));
    createTiffFrameOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.MinIsBlack);
    createTiffFrameOptions.setBitsPerSample(new int[]{8});

    // Create a grayscale copy of the active frame.
    // The pixel data is preserved but converted to the desired format.
    com.aspose.imaging.fileformats.tiff.TiffFrame grayscaleFrame
            = com.aspose.imaging.fileformats.tiff.TiffFrame.createFrameFrom(tiffImage.getActiveFrame(), createTiffFrameOptions);

    // Add the newly created frame to the TIFF image.
    tiffImage.addFrame(grayscaleFrame);

    tiffImage.save();
} finally {
    tiffImage.dispose();
}

getPlanarConfiguration()

public int getPlanarConfiguration()

Gets or sets the planar configuration.

Returns: int - The planar configuration.

setPlanarConfiguration(int value)

public void setPlanarConfiguration(int value)

Gets or sets the planar configuration.

Parameters:

ParameterTypeDescription
valueintThe planar configuration.

Example: This example shows how to create a TIFF image from scratch and save it to a file.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions createOptions =
        new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 8 bits for each color component.
createOptions.setBitsPerSample(new int[]{8, 8, 8});

// Set the Big Endian byte order (Motorola)
createOptions.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.BigEndian);

// Set the LZW compression.
createOptions.setCompression(com.aspose.imaging.fileformats.tiff.enums.TiffCompressions.Lzw);

// Set the RGB color model.
createOptions.setPhotometric(com.aspose.imaging.fileformats.tiff.enums.TiffPhotometrics.Rgb);

// All color components will be stored within a single plane.
createOptions.setPlanarConfiguration(com.aspose.imaging.fileformats.tiff.enums.TiffPlanarConfigs.Contiguous);

// Create a TIFF Frame of 100x100 px.
// Note that you don't have to dispose a frame explicitly if it is included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
com.aspose.imaging.fileformats.tiff.TiffFrame firstFrame = new com.aspose.imaging.fileformats.tiff.TiffFrame(createOptions, 100, 100);

// Fill the entire frame with the blue-yellow gradient.
com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush(
        new com.aspose.imaging.Point(0, 0),
        new com.aspose.imaging.Point(firstFrame.getWidth(), firstFrame.getHeight()),
        com.aspose.imaging.Color.getBlue(),
        com.aspose.imaging.Color.getYellow());

com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(firstFrame);
graphics.fillRectangle(gradientBrush, firstFrame.getBounds());

// Create a TIFF image.
com.aspose.imaging.fileformats.tiff.TiffImage tiffImage = new com.aspose.imaging.fileformats.tiff.TiffImage(firstFrame);
try {
    tiffImage.save(dir + "output.tif");
} finally {
    tiffImage.dispose();
}

getResolutionUnit()

public int getResolutionUnit()

Gets or sets the resolution unit.

Returns: int - The resolution unit.

setResolutionUnit(int value)

public void setResolutionUnit(int value)

Gets or sets the resolution unit.

Parameters:

ParameterTypeDescription
valueintThe resolution unit.

getRowsPerStrip()

public long getRowsPerStrip()

Gets or sets the rows per strip.

Returns: long - The rows per strip.

setRowsPerStrip(long value)

public void setRowsPerStrip(long value)

Gets or sets the rows per strip.

Parameters:

ParameterTypeDescription
valuelongThe rows per strip.

getTileWidth()

public long getTileWidth()

Gets ot sets tile width.

Returns: long

setTileWidth(long value)

public void setTileWidth(long value)

Gets ot sets tile width.

Parameters:

ParameterTypeDescription
valuelong

getTileLength()

public long getTileLength()

Gets ot sets tile length.

Returns: long

setTileLength(long value)

public void setTileLength(long value)

Gets ot sets tile length.

Parameters:

ParameterTypeDescription
valuelong

getSampleFormat()

public int[] getSampleFormat()

Gets or sets the sample format.

Returns: int[] - The sample format.

setSampleFormat(int[] value)

public void setSampleFormat(int[] value)

Gets or sets the sample format.

Parameters:

ParameterTypeDescription
valueint[]The sample format.

getSamplesPerPixel()

public int getSamplesPerPixel()

Gets the samples per pixel. To change this property value use the BitsPerSample property setter.

Returns: int - The samples per pixel.

getSmaxSampleValue()

public long[] getSmaxSampleValue()

Gets or sets the max sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

Returns: long[] - The max sample value.

setSmaxSampleValue(long[] value)

public void setSmaxSampleValue(long[] value)

Gets or sets the max sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

Parameters:

ParameterTypeDescription
valuelong[]The max sample value.

getSminSampleValue()

public long[] getSminSampleValue()

Gets or sets the min sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

Returns: long[] - The min sample value.

setSminSampleValue(long[] value)

public void setSminSampleValue(long[] value)

Gets or sets the min sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

Parameters:

ParameterTypeDescription
valuelong[]The min sample value.

getSoftwareType()

public String getSoftwareType()

Gets or sets the software type.

Returns: java.lang.String - The software type.

setSoftwareType(String value)

public void setSoftwareType(String value)

Gets or sets the software type.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe software type.

getStripByteCounts()

public long[] getStripByteCounts()

Gets or sets the strip byte counts.

Returns: long[] - The strip byte counts.

setStripByteCounts(long[] value)

public void setStripByteCounts(long[] value)

Gets or sets the strip byte counts.

Parameters:

ParameterTypeDescription
valuelong[]The strip byte counts.

getStripOffsets()

public long[] getStripOffsets()

Gets or sets the strip offsets.

Returns: long[] - The strip offsets.

setStripOffsets(long[] value)

public void setStripOffsets(long[] value)

Gets or sets the strip offsets.

Parameters:

ParameterTypeDescription
valuelong[]The strip offsets.

getTileByteCounts()

public long[] getTileByteCounts()

Gets or sets the tile byte counts.

Returns: long[]

setTileByteCounts(long[] value)

public void setTileByteCounts(long[] value)

Gets or sets the tile byte counts.

Parameters:

ParameterTypeDescription
valuelong[]

getTileOffsets()

public long[] getTileOffsets()

Gets or sets the tile offsets.

Returns: long[]

setTileOffsets(long[] value)

public void setTileOffsets(long[] value)

Gets or sets the tile offsets.

Parameters:

ParameterTypeDescription
valuelong[]

getSubFileType()

public long getSubFileType()

Gets or sets a general indication of the kind of data contained in this subfile.

Returns: long - The general indication of the kind of data contained in this subfile.

setSubFileType(long value)

public void setSubFileType(long value)

Gets or sets a general indication of the kind of data contained in this subfile.

Parameters:

ParameterTypeDescription
valuelongThe general indication of the kind of data contained in this subfile.

getTargetPrinter()

public String getTargetPrinter()

Gets or sets the target printer.

Returns: java.lang.String - The target printer.

setTargetPrinter(String value)

public void setTargetPrinter(String value)

Gets or sets the target printer.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe target printer.

getThreshholding()

public int getThreshholding()

Gets or sets the threshholding.

Returns: int - The threshholding.

setThreshholding(int value)

public void setThreshholding(int value)

Gets or sets the threshholding.

Parameters:

ParameterTypeDescription
valueintThe threshholding.

getTotalPages()

public int getTotalPages()

Gets the total pages.

Returns: int - The total pages.

getXposition()

public TiffRational getXposition()

Gets or sets the x position.

Returns: TiffRational - The x position.

setXposition(TiffRational value)

public void setXposition(TiffRational value)

Gets or sets the x position.

Parameters:

ParameterTypeDescription
valueTiffRationalThe x position.

getResolutionSettings()

public ResolutionSetting getResolutionSettings()

Gets or sets the resolution settings.

Returns: ResolutionSetting

setResolutionSettings(ResolutionSetting value)

public void setResolutionSettings(ResolutionSetting value)

Gets or sets the resolution settings.

Parameters:

ParameterTypeDescription
valueResolutionSetting

getXresolution()

public TiffRational getXresolution()

Gets or sets the x resolution.

Returns: TiffRational - The x resolution.

setXresolution(TiffRational value)

public void setXresolution(TiffRational value)

Gets or sets the x resolution.

Parameters:

ParameterTypeDescription
valueTiffRationalThe x resolution.

getYposition()

public TiffRational getYposition()

Gets or sets the y position.

Returns: TiffRational - The y position.

setYposition(TiffRational value)

public void setYposition(TiffRational value)

Gets or sets the y position.

Parameters:

ParameterTypeDescription
valueTiffRationalThe y position.

getYresolution()

public TiffRational getYresolution()

Gets or sets the y resolution.

Returns: TiffRational - The y resolution.

setYresolution(TiffRational value)

public void setYresolution(TiffRational value)

Gets or sets the y resolution.

Parameters:

ParameterTypeDescription
valueTiffRationalThe y resolution.

getFaxT4Options()

public long getFaxT4Options()

Gets or sets the fax t4 options.

Returns: long - The fax t4 options.

setFaxT4Options(long value)

public void setFaxT4Options(long value)

Gets or sets the fax t4 options.

Parameters:

ParameterTypeDescription
valuelongThe fax t4 options.

getPredictor()

public int getPredictor()

Gets or sets the predictor for LZW compression.

Returns: int - The predictor type.

setPredictor(int value)

public void setPredictor(int value)

Gets or sets the predictor for LZW compression.

Parameters:

ParameterTypeDescription
valueintThe predictor type.

Example: This example shows how to save a raster image to the TIFF format using various options.

String dir = "c:\\temp\\";

com.aspose.imaging.imageoptions.TiffOptions saveOptions
        = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default);

// Set 8 bits for each color component.
saveOptions.setBitsPerSample(new int[]{8, 8, 8});

// Set the Big Endian byte order (Motorola)
saveOptions.setByteOrder(com.aspose.imaging.fileformats.tiff.enums.TiffByteOrder.BigEndian);

// Set the LZW compression.
saveOptions.setCompression(com.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.setPredictor(com.aspose.imaging.fileformats.tiff.enums.TiffPredictor.Horizontal);

// Set the RGB color model.
saveOptions.setPhotometric(com.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 single plane.
saveOptions.setPlanarConfiguration(com.aspose.imaging.fileformats.tiff.enums.TiffPlanarConfigs.Contiguous);

// Create a TIFF Frame of 100x100 px.
com.aspose.imaging.Image image = new com.aspose.imaging.fileformats.bmp.BmpImage(100, 100);
try {
    // Fill the entire image with the blue-yellow gradient.
    com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush(
            new com.aspose.imaging.Point(0, 0),
            new com.aspose.imaging.Point(image.getWidth(), image.getHeight()),
            com.aspose.imaging.Color.getBlue(),
            com.aspose.imaging.Color.getYellow());

    com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(image);
    graphics.fillRectangle(gradientBrush, image.getBounds());

    image.save(dir + "output.tif", saveOptions);
} finally {
    image.dispose();
}

getImageLength()

public long getImageLength()

Gets or sets the image length.

Returns: long - The image length.

setImageLength(long value)

public void setImageLength(long value)

Gets or sets the image length.

Parameters:

ParameterTypeDescription
valuelongThe image length.

getImageWidth()

public long getImageWidth()

Gets or sets the image width.

Returns: long - The image width.

setImageWidth(long value)

public void setImageWidth(long value)

Gets or sets the image width.

Parameters:

ParameterTypeDescription
valuelongThe image width.

getExifIfd()

public TiffExifIfd getExifIfd()

Gets or sets the pointer to EXIF IFD.

Returns: TiffExifIfd - The pointer to EXIF IFD.

getTags()

public TiffDataType[] getTags()

Gets or sets the tags.

Returns: com.aspose.imaging.fileformats.tiff.TiffDataType[] - The tags.

setTags(TiffDataType[] value)

public void setTags(TiffDataType[] value)

Gets or sets the tags.

Parameters:

ParameterTypeDescription
valueTiffDataType[]The tags.

getValidTagCount()

public int getValidTagCount()

Gets the valid tag count. This is not the total tags count but the number of tags which may be preserved.

Returns: int - The valid tag count.

getBitsPerPixel()

public int getBitsPerPixel()

Gets the bits per pixel.

Returns: int - The bits per pixel.

getXPTitle()

public final String getXPTitle()

Gets information about image, which used by Windows Explorer.

Value: Information about image, used by Windows Explorer. The XPTitle(\#getXPTitle/.setXPTitle(String)) is ignored by Windows Explorer if the ImageDescription(.getImageDescription/.setImageDescription(String)) tag exists.

Returns: java.lang.String - information about image, which used by Windows Explorer.

setXPTitle(String value)

public final void setXPTitle(String value)

Sets information about image, which used by Windows Explorer.

Value: Information about image, used by Windows Explorer. The XPTitle(.getXPTitle/\#setXPTitle(String)) is ignored by Windows Explorer if the ImageDescription(.getImageDescription/.setImageDescription(String)) tag exists.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringinformation about image, which used by Windows Explorer.

getXPComment()

public final String getXPComment()

Gets comment on image, which used by Windows Explorer.

Value: Comment on image, used by Windows Explorer.

Returns: java.lang.String - comment on image, which used by Windows Explorer.

setXPComment(String value)

public final void setXPComment(String value)

Sets comment on image, which used by Windows Explorer.

Value: Comment on image, used by Windows Explorer.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringcomment on image, which used by Windows Explorer.

getXPAuthor()

public final String getXPAuthor()

Gets image author, which used by Windows Explorer.

Value: Image Author, used by Windows Explorer. The XPAuthor(\#getXPAuthor/.setXPAuthor(String)) is ignored by Windows Explorer if the Artist(.getArtist/.setArtist(String)) tag exists.

Returns: java.lang.String - image author, which used by Windows Explorer.

setXPAuthor(String value)

public final void setXPAuthor(String value)

Sets image author, which used by Windows Explorer.

Value: Image Author, used by Windows Explorer. The XPAuthor(.getXPAuthor/\#setXPAuthor(String)) is ignored by Windows Explorer if the Artist(.getArtist/.setArtist(String)) tag exists.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringimage author, which used by Windows Explorer.

getXPKeywords()

public final String getXPKeywords()

Gets subject image, which used by Windows Explorer.

Value: Subject image, used by Windows Explorer.

Returns: java.lang.String - subject image, which used by Windows Explorer.

setXPKeywords(String value)

public final void setXPKeywords(String value)

Sets subject image, which used by Windows Explorer.

Value: Subject image, used by Windows Explorer.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringsubject image, which used by Windows Explorer.

getXPSubject()

public final String getXPSubject()

Gets information about image, which used by Windows Explorer.

Value: Information about image, used by Windows Explorer.

Returns: java.lang.String - information about image, which used by Windows Explorer.

setXPSubject(String value)

public final void setXPSubject(String value)

Sets information about image, which used by Windows Explorer.

Value: Information about image, used by Windows Explorer.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringinformation about image, which used by Windows Explorer.

getExifData()

public final ExifData getExifData()

Gets Exif data.

Returns: ExifData - Exif data.

setExifData(ExifData value)

public final void setExifData(ExifData value)

Sets Exif data.

Parameters:

ParameterTypeDescription
valueExifDataExif data.

removeTag(int tag)

public boolean removeTag(int tag)

Removes the tag.

Parameters:

ParameterTypeDescription
tagintThe tag to remove.

Returns: boolean - true if successfully removed

removeTags(int[] tags)

public final boolean removeTags(int[] tags)

Removes the tags.

Parameters:

ParameterTypeDescription
tagsint[]The tags to remove.

Returns: boolean - `` if tag collection size changed.

validate()

public void validate()

Validates if options have valid combination of tags

addTags(TiffDataType[] tagsToAdd)

public void addTags(TiffDataType[] tagsToAdd)

Adds the tags.

Parameters:

ParameterTypeDescription
tagsToAddTiffDataType[]The tags to add.

addTag(TiffDataType tagToAdd)

public void addTag(TiffDataType tagToAdd)

Adds a new tag.

Parameters:

ParameterTypeDescription
tagToAddTiffDataTypeThe tag to add.

getTagByType(int tagKey)

public TiffDataType getTagByType(int tagKey)

Gets the instance of the tag by type.

Parameters:

ParameterTypeDescription
tagKeyintThe tag key.

Returns: TiffDataType - Instance of the tag if exists or null otherwise.