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
Name | Description |
---|---|
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
Name | Type | Access | Description |
---|---|---|---|
alpha_storage | TiffAlphaStorage | r/w | Gets or sets the alpha storage option. Options other than TiffAlphaStorage.UNSPECIFIED are used when there are more than 3 TiffOptions.samples_per_pixel defined. |
artist | string | r/w | Gets or sets the artist. |
bits_per_pixel | int | r | Gets the bits per pixel. |
bits_per_sample | ushort | r/w | Gets or sets the bits per sample. |
buffer_size_hint | int | r/w | Gets or sets the buffer size hint which is defined max allowed size for all internal buffers. |
byte_order | TiffByteOrder | r/w | Gets or sets a value indicating the tiff byte order. |
color_map | ushort | r/w | Gets or sets the color map. |
compressed_quality | int | r/w | Gets or sets compressed image quality. Used with the Jpeg compression. |
compression | TiffCompressions | r/w | Gets or sets the compression. |
copyright | string | r/w | Gets or sets the copyright. |
date_time | string | r/w | Gets or sets the date and time. |
default_memory_allocation_limit | int | r/w | Gets or sets the default memory allocation limit. |
disable_icc_export | bool | r/w | Gets or sets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand). |
disposed | bool | r | Gets a value indicating whether this instance is disposed. |
document_name | string | r/w | Gets or sets the name of the document. |
exif_data | ExifData | r/w | Gets or sets Exif data. |
exif_ifd | TiffExifIfd | r | Gets or sets the pointer to EXIF IFD. |
extra_samples | ushort | r | Gets the extra samples values. |
fax_t4_options | Group3Options | r/w | Gets or sets the fax t4 options. |
file_standard | TiffFileStandards | r/w | Gets or sets the TIFF file standard. |
fill_order | TiffFillOrders | r/w | Gets or sets the byte bits fill order. |
full_frame | bool | r/w | Gets or sets a value indicating whether [full frame]. |
half_tone_hints | ushort | r/w | Gets or sets the halftone hints. |
image_description | string | r/w | Gets or sets the image description. |
image_length | uint | r/w | Gets or sets the image length. |
image_width | uint | r/w | Gets or sets the image width. |
ink_names | string | r/w | Gets or sets the ink names. |
is_extra_samples_present | bool | r | Gets a value indicating whether the extra samples is present. |
is_tiled | bool | r | Gets a value indicating whether image is tiled. |
is_valid | bool | r | Gets a value indicating whether the TiffOptions have been properly configured. Use Validate method as to find the failure reason. |
keep_metadata | bool | r/w | Gets a value whether to keep original image metadata on export. |
max_sample_value | ushort | r/w | Gets or sets the max sample value. |
min_sample_value | ushort | r/w | Gets or sets the min sample value. |
multi_page_options | MultiPageOptions | r/w | The multipage options |
orientation | TiffOrientations | r/w | Gets or sets the orientation. |
page_name | string | r/w | Gets or sets the page name. |
page_number | ushort | r/w | Gets or sets the page number tag. |
palette | IColorPalette | r/w | Gets or sets the color palette. |
photometric | TiffPhotometrics | r/w | Gets or sets the photometric. |
planar_configuration | TiffPlanarConfigs | r/w | Gets or sets the planar configuration. |
predictor | TiffPredictor | r/w | Gets or sets the predictor for LZW compression. |
premultiply_components | bool | r/w | Gets or sets a value indicating whether components must be premultiplied. |
resolution_settings | ResolutionSetting | r/w | Gets or sets the resolution settings. |
resolution_unit | TiffResolutionUnits | r/w | Gets or sets the resolution unit. |
rows_per_strip | uint | r/w | Gets or sets the rows per strip. |
sample_format | TiffSampleFormats[] | r/w | Gets or sets the sample format. |
samples_per_pixel | ushort | r | Gets the samples per pixel. To change this property value use the TiffOptions.bits_per_sample property setter. |
scanner_manufacturer | string | r/w | Gets or sets the scanner manufacturer. |
scanner_model | string | r/w | Gets or sets the scanner model. |
smax_sample_value | uint | r/w | Gets 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_value | uint | r/w | Gets or sets the min sample value. The value has a field type which best matches the sample data (Byte, Short or Long type). |
software_type | string | r/w | Gets or sets the software type. |
source | Source | r/w | Gets or sets the source to create image in. |
strip_byte_counts | ulong | r/w | Gets or sets the strip byte counts. |
strip_offsets | ulong | r/w | Gets or sets the strip offsets. |
sub_file_type | TiffNewSubFileTypes | r/w | Gets or sets a general indication of the kind of data contained in this subfile. |
tag_count | int | r | Gets the tag count. |
tags | TiffDataType[] | r/w | Gets or sets the tags. |
target_printer | string | r/w | Gets or sets the target printer. |
threshholding | TiffThresholds | r/w | Gets or sets the threshholding. |
tile_byte_counts | ulong | r/w | Gets or sets the tile byte counts. |
tile_length | uint | r/w | Gets ot sets tile length. |
tile_offsets | ulong | r/w | Gets or sets the tile offsets. |
tile_width | uint | r/w | Gets ot sets tile width. |
total_pages | ushort | r | Gets the total pages. |
valid_tag_count | int | r | Gets the valid tag count. This is not the total tags count but the number of tags which may be preserved. |
vector_rasterization_options | VectorRasterizationOptions | r/w | Gets or sets the vector rasterization options. |
xmp_data | XmpPacketWrapper | r/w | Gets or sets the XMP metadata container. |
xp_author | string | r/w | Gets or sets image author, which used by Windows Explorer. |
xp_comment | string | r/w | Gets or sets comment on image, which used by Windows Explorer. |
xp_keywords | string | r/w | Gets or sets subject image, which used by Windows Explorer. |
xp_subject | string | r/w | Gets or sets information about image, which used by Windows Explorer. |
xp_title | string | r/w | Gets or sets information about image, which used by Windows Explorer. |
xposition | TiffRational | r/w | Gets or sets the x position. |
xresolution | TiffRational | r/w | Gets or sets the x resolution. |
y_cb_cr_coefficients | TiffRational[] | r/w | Gets or sets the YCbCrCoefficients. |
y_cb_cr_subsampling | ushort | r/w | Gets or sets the subsampling factors for YCbCr photometric. |
yposition | TiffRational | r/w | Gets or sets the y position. |
yresolution | TiffRational | r/w | Gets or sets the y resolution. |
Methods
Name | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
expected_format | TiffExpectedFormat | The expected tiff file format. |
Constructor: TiffOptions(expected_format, byte_order)
TiffOptions(expected_format, byte_order)
Initializes a new instance of the TiffOptions class.
Parameters:
Parameter | Type | Description |
---|---|---|
expected_format | TiffExpectedFormat | The expected tiff file format. |
byte_order | TiffByteOrder | The tiff file format byte order to use. |
Constructor: TiffOptions(options)
TiffOptions(options)
Initializes a new instance of the TiffOptions class.
Parameters:
Parameter | Type | Description |
---|---|---|
options | TiffOptions | The options to copy from. |
Constructor: TiffOptions(tags)
TiffOptions(tags)
Initializes a new instance of the TiffOptions class.
Parameters:
Parameter | Type | Description |
---|---|---|
tags | TiffDataType[] | The tags to initialize options with. |
Method: add_tag(tag_to_add)
add_tag(tag_to_add)
Adds a new tag.
Parameters:
Parameter | Type | Description |
---|---|---|
tag_to_add | TiffDataType | The tag to add. |
Method: add_tags(tags_to_add)
add_tags(tags_to_add)
Adds the tags.
Parameters:
Parameter | Type | Description |
---|---|---|
tags_to_add | TiffDataType[] | The tags to add. |
Method: clone()
clone()
Clones this instance.
Returns
Type | Description |
---|---|
ImageOptionsBase | Returns 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:
Parameter | Type | Description |
---|---|---|
expected_format | TiffExpectedFormat | The expected tiff file format. |
Returns
Type | Description |
---|---|
TiffOptions |
Method: create_with_options(options) [static]
create_with_options(options)
Initializes a new instance of the TiffOptions class.
Parameters:
Parameter | Type | Description |
---|---|---|
options | TiffOptions | The options to copy from. |
Returns
Type | Description |
---|---|
TiffOptions |
Method: create_with_tags(tags) [static]
create_with_tags(tags)
Initializes a new instance of the TiffOptions class.
Parameters:
Parameter | Type | Description |
---|---|---|
tags | TiffDataType[] | The tags to initialize options with. |
Returns
Type | Description |
---|---|
TiffOptions |
Method: get_tag_by_type(tag_key)
get_tag_by_type(tag_key)
Gets the instance of the tag by type.
Parameters:
Parameter | Type | Description |
---|---|---|
tag_key | TiffTags | The tag key. |
Returns
Type | Description |
---|---|
TiffDataType | Instance 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:
Parameter | Type | Description |
---|---|---|
tags | TiffDataType[] | The tags to validate. |
Returns
Type | Description |
---|---|
int | The valid tags count. |
Method: is_tag_present(tag)
is_tag_present(tag)
Determines whether tag is present in the options or not.
Parameters:
Parameter | Type | Description |
---|---|---|
tag | TiffTags | The tag id to check. |
Returns
Type | Description |
---|---|
bool |
Method: remove_tag(tag)
remove_tag(tag)
Removes the tag.
Parameters:
Parameter | Type | Description |
---|---|---|
tag | TiffTags | The tag to remove. |
Returns
Type | Description |
---|---|
bool | true if successfully removed |
Method: remove_tags(tags)
remove_tags(tags)
Removes the tags.
Parameters:
Parameter | Type | Description |
---|---|---|
tags | TiffTags[] | The tags to remove. |
Returns
Type | Description |
---|---|
bool | True 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))