ApngOptions Class
Summary: The API for Animated PNG (Animated Portable Network Graphics) image file format
creation is a dynamic tool for developers seeking to generate captivating
animated images. With customizable options such as frame duration and the
number of times to loop, this API allows for fine-tuning animated content
according to specific needs. Whether creating engaging web graphics or
interactive visuals, you can leverage this API to seamlessly incorporate
APNG images with precise control over animation parameters.
Module: aspose.imaging.imageoptions
Full Name: aspose.imaging.imageoptions.ApngOptions
Inheritance: IHasXmpData, IHasMetadata, PngOptions
Constructors
Name | Description |
---|---|
ApngOptions() | Initializes a new instance of the ApngOptions class. |
Properties
Name | Type | Access | Description |
---|---|---|---|
DEFAULT_COMPRESSION_LEVEL [static] | int | r | The default compression level. |
bit_depth | byte | r/w | Gets or sets the bit depth values in range of 1, 2, 4, 8, 16. Mind the next limits: PngColorType.GRAYSCALE, PngColorType.INDEXED_COLOR support bit depth of 1, 2, 4, 8. PngColorType.GRAYSCALE_WITH_ALPHA supports bit depth of 8. PngColorType.TRUECOLOR, PngColorType.TRUECOLOR_WITH_ALPHA support bit depth of 8, 16. |
buffer_size_hint | int | r/w | Gets or sets the buffer size hint which is defined max allowed size for all internal buffers. |
color_type | PngColorType | r/w | Gets or sets the type of the color. |
compression_level | int | r/w | Gets or sets the PngImage compression level in the range of 0-9. The higher the value - the more efficient the compression. |
default_frame_time | uint | r/w | Gets or sets the default frame duration. |
disposed | bool | r | Gets a value indicating whether this instance is disposed. |
filter_type | PngFilterType | r/w | Gets or sets the filter type used during png file save process. |
full_frame | bool | r/w | Gets or sets a value indicating whether [full frame]. |
keep_metadata | bool | r/w | Gets a value whether to keep original image metadata on export. |
multi_page_options | MultiPageOptions | r/w | The multipage options |
num_plays | int | r/w | Gets or sets the number of times to loop animation. 0 indicates infinite looping. |
palette | IColorPalette | r/w | Gets or sets the color palette. |
progressive | bool | r/w | Gets or sets a value indicating whether a PngImage is progressive. |
resolution_settings | ResolutionSetting | r/w | Gets or sets the resolution settings. |
source | Source | r/w | Gets or sets the source to create image in. |
vector_rasterization_options | VectorRasterizationOptions | r/w | Gets or sets the vector rasterization options. |
xmp_data | XmpPacketWrapper | r/w | Gets or sets Xmp data. |
Methods
Name | Description |
---|---|
clone() | Creates a memberwise clone of this instance. |
Constructor: ApngOptions()
ApngOptions()
Initializes a new instance of the ApngOptions class.
Property: default_frame_time
Gets or sets the default frame duration.
See also:
Example # 1: The following example shows how to export apng APNG file format from other no…
Property: num_plays
Gets or sets the number of times to loop animation.
0 indicates infinite looping.
See also:
Example # 1: The following example shows how to export to APNG file format.
Method: clone()
clone()
Creates a memberwise clone of this instance.
Returns
Type | Description |
---|---|
ImageOptionsBase | A memberwise clone of this instance. |
Examples
The following example shows how to export to APNG file format.
import aspose.pycore as aspycore
from aspose.imaging import *
from aspose.imaging.imageoptions import *
with Image.load("Animation1.webp") as image:
# Export to APNG animation with unlimited animation cycles as default
image.save("Animation1.webp.png", ApngOptions())
# Setting up animation cycles
obj_init = ApngOptions()
# 5 cycles
obj_init.num_plays = 5
image.save("Animation2.webp.png", obj_init)
The following example shows how to export apng APNG file format from other non-animated multi-page format.
from aspose.imaging import Image
from aspose.imaging.imageoptions import ApngOptions
with Image.load("img4.tif") as image:
# Setting up the default frame duration
obj_init = ApngOptions()
# 500 ms
obj_init.default_frame_time = 500
image.save("img4.tif.500ms.png", obj_init)
obj_init2 = ApngOptions()
# 250 ms
obj_init2.default_frame_time = 250
image.save("img4.tif.250ms.png", obj_init2)