TiffOptions Class

Summary: 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.

Module: aspose.imaging.imageoptions

Full Name: aspose.imaging.imageoptions.TiffOptions

Inheritance: IHasXmpData, IHasMetadata, IHasExifData, ImageOptionsBase

Constructors

NameDescription
TiffOptions(expected_format)Initializes a new instance of the TiffOptions class. By default little endian convention is used.
TiffOptions(expected_format, byte_order)Initializes a new instance of the TiffOptions class.
TiffOptions(options)Initializes a new instance of the TiffOptions class.
TiffOptions(tags)Initializes a new instance of the TiffOptions class.

Properties

NameTypeAccessDescription
alpha_storageTiffAlphaStorager/wGets or sets the alpha storage option. Options other than TiffAlphaStorage.UNSPECIFIED
are used when there are more than 3 TiffOptions.samples_per_pixel defined.
artiststringr/wGets or sets the artist.
bits_per_pixelintrGets the bits per pixel.
bits_per_sampleushortr/wGets or sets the bits per sample.
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
byte_orderTiffByteOrderr/wGets or sets a value indicating the tiff byte order.
color_mapushortr/wGets or sets the color map.
compressed_qualityintr/wGets or sets compressed image quality.
Used with the Jpeg compression.
compressionTiffCompressionsr/wGets or sets the compression.
copyrightstringr/wGets or sets the copyright.
date_timestringr/wGets or sets the date and time.
default_memory_allocation_limitintr/wGets or sets the default memory allocation limit.
disable_icc_exportboolr/wGets or sets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).
disposedboolrGets a value indicating whether this instance is disposed.
document_namestringr/wGets or sets the name of the document.
exif_dataExifDatar/wGets or sets Exif data.
exif_ifdTiffExifIfdrGets or sets the pointer to EXIF IFD.
extra_samplesushortrGets the extra samples values.
fax_t4_optionsGroup3Optionsr/wGets or sets the fax t4 options.
file_standardTiffFileStandardsr/wGets or sets the TIFF file standard.
fill_orderTiffFillOrdersr/wGets or sets the byte bits fill order.
full_frameboolr/wGets or sets a value indicating whether [full frame].
half_tone_hintsushortr/wGets or sets the halftone hints.
image_descriptionstringr/wGets or sets the image description.
image_lengthuintr/wGets or sets the image length.
image_widthuintr/wGets or sets the image width.
ink_namesstringr/wGets or sets the ink names.
is_extra_samples_presentboolrGets a value indicating whether the extra samples is present.
is_tiledboolrGets a value indicating whether image is tiled.
is_validboolrGets a value indicating whether the TiffOptions have been properly configured. Use Validate method as to find the failure reason.
keep_metadataboolr/wGets a value whether to keep original image metadata on export.
max_sample_valueushortr/wGets or sets the max sample value.
min_sample_valueushortr/wGets or sets the min sample value.
multi_page_optionsMultiPageOptionsr/wThe multipage options
orientationTiffOrientationsr/wGets or sets the orientation.
page_namestringr/wGets or sets the page name.
page_numberushortr/wGets or sets the page number tag.
paletteIColorPaletter/wGets or sets the color palette.
photometricTiffPhotometricsr/wGets or sets the photometric.
planar_configurationTiffPlanarConfigsr/wGets or sets the planar configuration.
predictorTiffPredictorr/wGets or sets the predictor for LZW compression.
premultiply_componentsboolr/wGets or sets a value indicating whether components must be premultiplied.
resolution_settingsResolutionSettingr/wGets or sets the resolution settings.
resolution_unitTiffResolutionUnitsr/wGets or sets the resolution unit.
rows_per_stripuintr/wGets or sets the rows per strip.
sample_formatTiffSampleFormats[]r/wGets or sets the sample format.
samples_per_pixelushortrGets the samples per pixel. To change this property value use the TiffOptions.bits_per_sample property setter.
scanner_manufacturerstringr/wGets or sets the scanner manufacturer.
scanner_modelstringr/wGets or sets the scanner model.
smax_sample_valueuintr/wGets or sets the max sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).
smin_sample_valueuintr/wGets or sets the min sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).
software_typestringr/wGets or sets the software type.
sourceSourcer/wGets or sets the source to create image in.
strip_byte_countsulongr/wGets or sets the strip byte counts.
strip_offsetsulongr/wGets or sets the strip offsets.
sub_file_typeTiffNewSubFileTypesr/wGets or sets a general indication of the kind of data contained in this subfile.
tag_countintrGets the tag count.
tagsTiffDataType[]r/wGets or sets the tags.
target_printerstringr/wGets or sets the target printer.
threshholdingTiffThresholdsr/wGets or sets the threshholding.
tile_byte_countsulongr/wGets or sets the tile byte counts.
tile_lengthuintr/wGets ot sets tile length.
tile_offsetsulongr/wGets or sets the tile offsets.
tile_widthuintr/wGets ot sets tile width.
total_pagesushortrGets the total pages.
valid_tag_countintrGets the valid tag count. This is not the total tags count but the number of tags which may be preserved.
vector_rasterization_optionsVectorRasterizationOptionsr/wGets or sets the vector rasterization options.
xmp_dataXmpPacketWrapperr/wGets or sets the XMP metadata container.
xp_authorstringr/wGets or sets image author, which used by Windows Explorer.
xp_commentstringr/wGets or sets comment on image, which used by Windows Explorer.
xp_keywordsstringr/wGets or sets subject image, which used by Windows Explorer.
xp_subjectstringr/wGets or sets information about image, which used by Windows Explorer.
xp_titlestringr/wGets or sets information about image, which used by Windows Explorer.
xpositionTiffRationalr/wGets or sets the x position.
xresolutionTiffRationalr/wGets or sets the x resolution.
y_cb_cr_coefficientsTiffRational[]r/wGets or sets the YCbCrCoefficients.
y_cb_cr_subsamplingushortr/wGets or sets the subsampling factors for YCbCr photometric.
ypositionTiffRationalr/wGets or sets the y position.
yresolutionTiffRationalr/wGets or sets the y resolution.

Methods

NameDescription
add_tag(tag_to_add)Adds a new tag.
add_tags(tags_to_add)Adds the tags.
clone()Clones this instance.
create_with_format(expected_format)Initializes a new instance of the TiffOptions class. By default little endian convention is used.
create_with_options(options)Initializes a new instance of the TiffOptions class.
create_with_tags(tags)Initializes a new instance of the TiffOptions class.
get_tag_by_type(tag_key)Gets the instance of the tag by type.
get_valid_tags_count(tags)Gets the valid tags count.
is_tag_present(tag)Determines whether tag is present in the options or not.
remove_tag(tag)Removes the tag.
remove_tags(tags)Removes the tags.
validate()Validates if options have valid combination of tags

Constructor: TiffOptions(expected_format)

 TiffOptions(expected_format) 

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

Parameters:

ParameterTypeDescription
expected_formatTiffExpectedFormatThe expected tiff file format.

Constructor: TiffOptions(expected_format, byte_order)

 TiffOptions(expected_format, byte_order) 

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
expected_formatTiffExpectedFormatThe expected tiff file format.
byte_orderTiffByteOrderThe tiff file format byte order to use.

Constructor: TiffOptions(options)

 TiffOptions(options) 

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
optionsTiffOptionsThe options to copy from.

Constructor: TiffOptions(tags)

 TiffOptions(tags) 

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
tagsTiffDataType[]The tags to initialize options with.

Method: add_tag(tag_to_add)

 add_tag(tag_to_add) 

Adds a new tag.

Parameters:

ParameterTypeDescription
tag_to_addTiffDataTypeThe tag to add.

Method: add_tags(tags_to_add)

 add_tags(tags_to_add) 

Adds the tags.

Parameters:

ParameterTypeDescription
tags_to_addTiffDataType[]The tags to add.

Method: clone()

 clone() 

Clones this instance.

Returns

TypeDescription
ImageOptionsBaseReturns a deep clone.

Method: create_with_format(expected_format) [static]

 create_with_format(expected_format) 

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

Parameters:

ParameterTypeDescription
expected_formatTiffExpectedFormatThe expected tiff file format.

Returns

TypeDescription
TiffOptions

Method: create_with_options(options) [static]

 create_with_options(options) 

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
optionsTiffOptionsThe options to copy from.

Returns

TypeDescription
TiffOptions

Method: create_with_tags(tags) [static]

 create_with_tags(tags) 

Initializes a new instance of the TiffOptions class.

Parameters:

ParameterTypeDescription
tagsTiffDataType[]The tags to initialize options with.

Returns

TypeDescription
TiffOptions

Method: get_tag_by_type(tag_key)

 get_tag_by_type(tag_key) 

Gets the instance of the tag by type.

Parameters:

ParameterTypeDescription
tag_keyTiffTagsThe tag key.

Returns

TypeDescription
TiffDataTypeInstance of the tag if exists or null otherwise.

Method: get_valid_tags_count(tags) [static]

 get_valid_tags_count(tags) 

Gets the valid tags count.

Parameters:

ParameterTypeDescription
tagsTiffDataType[]The tags to validate.

Returns

TypeDescription
intThe valid tags count.

Method: is_tag_present(tag)

 is_tag_present(tag) 

Determines whether tag is present in the options or not.

Parameters:

ParameterTypeDescription
tagTiffTagsThe tag id to check.

Returns

TypeDescription
booltrue if tag is present; otherwise, false.

Method: remove_tag(tag)

 remove_tag(tag) 

Removes the tag.

Parameters:

ParameterTypeDescription
tagTiffTagsThe tag to remove.

Returns

TypeDescription
booltrue if successfully removed

Method: remove_tags(tags)

 remove_tags(tags) 

Removes the tags.

Parameters:

ParameterTypeDescription
tagsTiffTags[]The tags to remove.

Returns

TypeDescription
boolTrue if tag collection size changed.

Examples

This examples make use of GraphicsPath and Graphics classes to create and manipulate figures on an Image surface. Example creates a new Image (of type Tiff), clears the surface and draws paths with the help of GraphicsPath class. At the end draw_path method exposed by Graphics class is called to render the paths on surface.


from aspose.imaging import Image, Graphics, Color, GraphicsPath, Figure, RectangleF, PointF, SizeF
from aspose.imaging import Pen
from aspose.imaging.sources import StreamSource
from aspose.imaging.imageoptions import TiffOptions
from aspose.imaging.fileformats.tiff.enums import TiffExpectedFormat
from aspose.imaging.shapes import RectangleShape, EllipseShape, PieShape


# Create an instance of a file stream
with open(r"C:\temp\output.tiff", "w+b") as stream:
	# Create an instance of TiffOptions and set its various properties
	tiffOptions = TiffOptions(TiffExpectedFormat.DEFAULT)
	# Set the source for the instance of ImageOptions
	tiffOptions.source = StreamSource(stream)
	# Create an instance of Image
	with Image.create(tiffOptions, 500, 500) as image:
		# Create and initialize an instance of Graphics class
		graphics = Graphics(image)
		# Clear Graphics surface
		graphics.clear(Color.wheat);
		# Create an instance of GraphicsPath class
		graphics_path = GraphicsPath()
		# Create an instance of Figure class
		figure = Figure()
		# Add Shapes to Figure object
		figure.add_shape(RectangleShape(RectangleF(10.0, 10.0, 300.0, 300.0)))
		figure.add_shape(EllipseShape(RectangleF(50.0, 50.0, 300.0, 300.0)))
		figure.add_shape(PieShape(RectangleF(PointF(250.0, 250.0), SizeF(200.0, 200.0)), 0.0, 45.0))
		# Add Figure object to GraphicsPath
		graphics_path.add_figure(figure)
		# Draw path with Pen object of color Black
		graphics.draw_path(Pen(Color.black, 2.0), graphics_path)
		# save all changes.
		image.save()

This example demonstrates the use of different classes from imageoptions package for export purposes. A gif image is loaded as an instance of Image and then exported out to several formats.


from aspose.imaging import Image
from aspose.imaging.imageoptions import BmpOptions, JpegOptions, PngOptions, TiffOptions
from aspose.imaging.fileformats.tiff.enums import TiffExpectedFormat
from os.path import join as path_join

directory = "c:\\temp\\"
#Load an existing gif image as an instance of Image class
with Image.load(path_join(directory, "sample.gif")) as image:
	# Export to BMP file format using the default options
	image.save(path_join(directory, "output.bmp"), BmpOptions())
	# Export to JPEG file format using the default options
	image.save(path_join(directory, "output.jpg"), JpegOptions())
	# Export to PNG file format using the default options
	image.save(path_join(directory, "output.png"), PngOptions())
	# Export to TIFF file format using the default options
	image.save(path_join(directory, "output.tif"), TiffOptions(TiffExpectedFormat.DEFAULT))